]> git.piffa.net Git - sketchbook_andrea/blob - oggi/operator_1_basic/operator_1_basic.ino
1a8bd6bb248c511c606358097ce9e253c295bf73
[sketchbook_andrea] / oggi / operator_1_basic / operator_1_basic.ino
1 /*
2   Operatori base
3  
4  */
5
6 int a = 5;
7 int b = 10;
8 int c = 20;
9
10 void setup()                    // run once, when the sketch starts
11 {
12   Serial.begin(9600);           // set up Serial library at 9600 bps
13
14   Serial.println("Here is some math: ");
15
16   Serial.print("a = ");
17   Serial.println(a);
18   Serial.print("b = ");
19   Serial.println(b);
20   Serial.print("c = ");
21   Serial.println(c);
22
23   Serial.print("a + b = ");       // add
24   Serial.println(a + b);
25
26   Serial.print("a * c = ");       // multiply
27   Serial.println(a * c);
28
29   Serial.print("c / b = ");       // divide
30   Serial.println(c / b);
31
32   Serial.print("b - c = ");       // subtract
33   Serial.println(b - c);
34
35   Serial.print("b modulo a = ");       // Calculates the remainder when one integer is divided by another. 
36   Serial.println(b % a);
37
38   Serial.print("8 modulo 3 = ");       // Calculates the remainder when one integer is divided by another. 
39   Serial.println(8 % 3);
40
41   Serial.print("a incrementato ++ = ");       // Increments 
42   Serial.println(a++);                        // Increments AFTER the call
43   Serial.print("valore attuale di a: ");
44   Serial.println(a);
45   Serial.print("++a incrementato  = ");       
46   Serial.println(++a);                        // Increments BEFORE the call
47
48
49   Serial.print("b decrementato -- = ");       // Decrement
50   Serial.println(b--);
51   Serial.print("valore attuale di b: ");
52   Serial.println(b);
53   Serial.print("--b decrementato  = ");       
54   Serial.println(--b);
55
56 }
57
58 void loop()                     // we need this to be here even though its empty
59 {
60 }
61
62
63