-
Notifications
You must be signed in to change notification settings - Fork 0
1.4 On Your Own
Congratulations on completing the initial projects! By now, you should have a good understanding of some basic concepts in Arduino programming. As we move forward, the pace will pick up, and I will assume you are becoming more familiar with the Arduino IDE. If you have any questions, please ask a lead or a senior member of the team.
Here's a summary of what you've learned so far:
-
Setup and Loop
-
Description: The
setup()
function runs once when the program starts, and theloop()
function runs continuously. These are the two main functions in every Arduino sketch.
-
Description: The
-
Serial Communication
-
Description: Allows you to send and receive data to and from the computer. You can use
Serial.begin()
to start communication andSerial.println()
to print messages to the Serial Monitor.
-
Description: Allows you to send and receive data to and from the computer. You can use
-
Pin Modes
-
Description: Use
pinMode(pin, mode)
to configure a pin as an input or output. This determines how the pin behaves in your project.
-
Description: Use
-
Digital Read and Write
-
Description:
digitalRead(pin)
reads the state of a digital pin (HIGH or LOW).digitalWrite(pin, value)
sets a digital pin to HIGH or LOW, controlling devices like LEDs.
-
Description:
-
Delay Function
-
Description: The
delay(milliseconds)
function pauses the program for the specified amount of time, allowing you to control timing in your projects.
-
Description: The
-
Comments
-
Description: Comments are used to explain the code and make it easier to understand. You can use
//
for single-line comments and/* ... */
for multi-line comments.
-
Description: Comments are used to explain the code and make it easier to understand. You can use
-
Controlling Components
- Description: You have learned how to control LEDs, servos, and push buttons, enabling you to build interactive projects.
Now it's time to put your skills to the test! Create a simple project using what you've learned. Here is a project I recommend:
- LED Traffic Light: Create a traffic light simulation using three LEDs (red, yellow, green) to indicate stop and go. Make it such that when a button is pressed, the next LED is lit up. You can create different states, such as making a counter that will switch LEDs on each press of the push button.
- Use at least two LEDs and a push button.
- Include comments in your code explaining what each part does.
- Use
Serial.print
statements to show the state of your project in the Serial Monitor.
Once you've completed your project, present it to the team during our next meeting. Be prepared to explain how it works and any challenges you faced!
Good luck, and have fun creating!