Skip to content

Added example to Int doc #461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions Language/Variables/Data Types/int.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ categories: [ "Variables" ]
subCategories: [ "Data Types" ]
---





= int


Expand Down Expand Up @@ -48,11 +44,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, being 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]

Expand Down