Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

...

Let’s Get Started..

Blinky is the “Hello World” of Physical Computing

How do we implement this?

Digital Output

Three functions to know…

C++

Blocks

Code Block
themeConfluence
pinMode(pin, INPUT/OUTPUT);

ex: pinMode(13, OUTPUT
); digitalWrite(pin, HIGH/LOW); ex: digitalWrite(13, HIGH
);

// NOTE: -> functions are CASE-sensitive
]]

></ac:plain-text-body></ac:structured-macro><p><br /></p><p><br /></p></div></td><td><div class="content-wrapper"><p><ac:image ac:thumbnail="true" ac:width="300"><ri:attachment ri:filename="image2020-1-21_18-41-57.png" /></ac:image></p></div><p>Note: The block above corresponds to&nbsp;digitalWrite(pin, HIGH); inserted into loop().</p><p>pinMode(pin, OUTPUT); will be inserted into setup() automatically.</p></td></tr><tr><td colspan="1"><div class="content-wrapper"><ac:structured-macro ac:name="code" ac:schema-version="1" ac:macro-id="25a2f65c-bce8-4bff-81a5-20edbe1958df"><ac:parameter ac:name="theme">Confluence</ac:parameter><ac:plain-text-body><![CDATA[

digitalWrite(pin, HIGH/LOW);

ex: digitalWrite(13, HIGH);

image2020-1-21_18-41-57.pngImage Added

Note: The block above corresponds to digitalWrite(pin, HIGH); inserted into loop().

pinMode(pin, OUTPUT); will be inserted into setup() automatically.

C++

Blocks

Code Block
delay(time_ms);
 
ex: delay(2500); // delay of 2.5 sec.
// NOTE: -> functions are CASE-sensitive]] ></ac:plain-text-body></ac:structured-macro></div></td><td colspan="1"><div class="content-wrapper"><p><ac:image ac:thumbnail="true" ac:width="270"><ri:attachment ri:filename="image2020-1-21_18-45-15.png" /></ac:image></p></div></td></tr></tbody></table><p><span style="color: rgb(0,0,0);"><a href="

image2020-1-21_18-45-15.pngImage Added

https://www.arduino.cc/en/Reference

...

image2019-7-31_17-0-47.pngImage Added

image2020-1-19_22-52-35.pngImage Added

Type (instead of copy-pasting, if you are new to C/C++)

...

this

...

code,

...

click “Upload” and observe the built-in

...

LED.

...

 You have

...

just

...

completed

...

your

...

first

...

Arduino

...

program!

...

C++

Blocks

Code Block
// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
}
 
// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}
]] ></ac:plain-text-body></ac:structured-macro></div></td><td><div class="content-wrapper"><p><ac:image ac:thumbnail="true" ac:width="240"><ri:attachment ri:filename="image2020-1-19_22-34-39.png" /></ac:image></p><p><br /></p></div><p>Instead of using<ac:image ac:thumbnail="true" ac:width="150"><ri:attachment ri:filename="image2020-1-19_22-36-18.png" /></ac:image>,</p><p>it is fine to use<ac:image ac:thumbnail="true" ac:width="150"><ri:attachment ri:filename="image2020-1-19_22-33-59.png" /></ac:image>&nbsp;for pin 13.</p></td></tr></tbody></table><p><br /></p><p><br /></p>

image2020-1-19_22-34-39.pngImage Added

Instead of using

image2020-1-19_22-36-18.pngImage Added

it is fine to use

image2020-1-19_22-33-59.pngImage Added

for pin 13.