The interface
- The check mark is used to verify the code if there is an error.
- The arrow button uploads the code to arduino.
- 'New' opens a new window to code.
- 'Save' saves the code as an Arduino sketch.
There are 2 functions when you open a new sketch.
- void setup() {}
- void loop() {}
Tinkercad.com
"TinkerCAD" uses the same C++ code as Arduino IDE . Whatever block code you pick in TinkerCad, it'll also be translated to text code.
The setup function and pinMode
In 'setup' function, we tell our program to engage an Arduino pin by writing the function 'pinMode(,)' & in its parameters, we tell which pin number to engage & if we want to take its output or input from Arduino. Output means to take voltage out of Arduino while we use 'input' when we attach sensors because they are giving pulse to Arduino.
The loop function and digitalWrite
This function goes on repeat.
Inside the loop function, we place another function called 'digitalWrite' in its parameter, we tell the program that the pin we engaged for Input or output. do we give it a high voltage or low voltage.
After executing the code, the code loops again & again.
Please watch the video for this Blog on YouTube:
https://youtu.be/a4PSFc3nCss
No comments:
Post a Comment