From 47c14dc7e5d4a05c585578f9d5e80c5d28d1537a Mon Sep 17 00:00:00 2001 From: Leah Thomas Date: Fri, 5 Oct 2018 20:49:53 +0100 Subject: [PATCH 1/2] Added example to Int doc Added working code sample to int.adoc, along with explanation. --- Language/Variables/Data Types/int.adoc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Data Types/int.adoc b/Language/Variables/Data Types/int.adoc index 4ae27dcaa..c6fbef7de 100644 --- a/Language/Variables/Data Types/int.adoc +++ b/Language/Variables/Data Types/int.adoc @@ -48,11 +48,21 @@ The Arduino takes care of dealing with negative numbers for you, so that arithme [float] === Example Code // Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄ - +This code creates an integer called 'countUp', which is initially set as the number 0 (zero). The variable goes up by 1 (one) each loop and displayed on the serial monitor. [source,arduino] ---- - int ledPin = 13; + int countUp = 0; //creates a variable integer called 'countUp' + +void setup() { + Serial.begin(9600); // use the serial port to print the number +} + +void loop() { + countUp++; //Adds 1 to the countUp int on every loop + Serial.println(countUp); // prints out the current state of countUp + delay(1000); +} ---- [%hardbreaks] From deb38ea2ce0cc95a73134fe11f675800849e5179 Mon Sep 17 00:00:00 2001 From: Robson Couto Date: Fri, 5 Oct 2018 22:50:53 -0300 Subject: [PATCH 2/2] Small change in the example code description --- Language/Variables/Data Types/int.adoc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Language/Variables/Data Types/int.adoc b/Language/Variables/Data Types/int.adoc index c6fbef7de..e4539db7c 100644 --- a/Language/Variables/Data Types/int.adoc +++ b/Language/Variables/Data Types/int.adoc @@ -4,10 +4,6 @@ categories: [ "Variables" ] subCategories: [ "Data Types" ] --- - - - - = int @@ -48,11 +44,11 @@ The Arduino takes care of dealing with negative numbers for you, so that arithme [float] === Example Code // Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄ -This code creates an integer called 'countUp', which is initially set as the number 0 (zero). The variable goes up by 1 (one) each loop and displayed on the serial monitor. +This code creates an integer called 'countUp', which is initially set as the number 0 (zero). The variable goes up by 1 (one) each loop, being displayed on the serial monitor. [source,arduino] ---- - int countUp = 0; //creates a variable integer called 'countUp' +int countUp = 0; //creates a variable integer called 'countUp' void setup() { Serial.begin(9600); // use the serial port to print the number