]> git.piffa.net Git - sketchbook_andrea/blobdiff - programming/operators/operator_1_basic/operator_1_basic.ino
operatori + analog
[sketchbook_andrea] / programming / operators / operator_1_basic / operator_1_basic.ino
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 (file)
index 0000000..2d9a403
--- /dev/null
@@ -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
+{
+}
+
+