MJLorton Solar Power and Electronic Measurement Equipment Forum
Tutorials, lessons and courses => Tutorials, lessons and courses => Topic started by: MJLorton on October 18, 2012, 01:38:14 AM
-
This is the tutorial: http://www.youtube.com/watch?v=kV7FKL9FtwM
Here is the sample code / sketch I use in the tutorial:
/*
Tutorial to demonstrate functions by Martin Lorton - http://www.MJLorton.com
Solar Power and Electronic Measurement Equipment - http://www.youtube.com/user/mjlorton
*/
int AnsOne=0;
void setup() {
Serial.begin(9600); // Setup serial port for terminal
Serial.println("Hello YouTubers!");
Serial.println("Let's do Math!");
Addition (233,437);
Serial.println(ValChk (AnsOne));
Serial.println(Multiply (10));
Serial.println("All Done!");
}
void loop() {};
void Addition (int ValOne, int ValTwo) {
AnsOne=ValOne+ValTwo;
Serial.print(ValOne);
Serial.print("+");
Serial.print(ValTwo);
Serial.print("=");
Serial.println(AnsOne);}
int ValChk (int ValAns){
if (ValAns > 2000)
return 1;
else return 0;}
int Multiply (int ValFactor){
int MultiAns=AnsOne*ValFactor;
return MultiAns;}