X-Git-Url: http://git.piffa.net/web?a=blobdiff_plain;f=programming%2Foperators%2Foperator_1_basic%2Foperator_1_basic.ino;fp=programming%2Foperators%2Foperator_1_basic%2Foperator_1_basic.ino;h=2d9a403881d010dcec9c07041a9bfbaedd151dab;hb=e50f2cf8e7402ea56cd01835be9f88c53876bfd1;hp=0000000000000000000000000000000000000000;hpb=f7cdba7df419dcde095f911daa92deb9dcd283ec;p=sketchbook_andrea diff --git a/programming/operators/operator_1_basic/operator_1_basic.ino b/programming/operators/operator_1_basic/operator_1_basic.ino new file mode 100644 index 0000000..2d9a403 --- /dev/null +++ b/programming/operators/operator_1_basic/operator_1_basic.ino @@ -0,0 +1,46 @@ +/* + Operatori base + + */ + +int a = 5; +int b = 10; +int c = 20; + +void setup() // run once, when the sketch starts +{ + Serial.begin(9600); // set up Serial library at 9600 bps + + Serial.println("Here is some math: "); + + Serial.print("a = "); + Serial.println(a); + Serial.print("b = "); + Serial.println(b); + Serial.print("c = "); + Serial.println(c); + + Serial.print("a + b = "); // add + Serial.println(a + b); + + Serial.print("a * c = "); // multiply + Serial.println(a * c); + + Serial.print("c / b = "); // divide + Serial.println(c / b); + + Serial.print("b - c = "); // subtract + Serial.println(b - c); + + Serial.print("b modulo a = "); // Calculates the remainder when one integer is divided by another. + Serial.println(b % a); + + Serial.print("8 modulo 3 = "); // Calculates the remainder when one integer is divided by another. + Serial.println(8 % 3); +} + +void loop() // we need this to be here even though its empty +{ +} + +