Skip to content

1.4 On Your Own

John-Paul Chouery edited this page Aug 24, 2024 · 1 revision

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.

What You Know

Here's a summary of what you've learned so far:

  1. Setup and Loop

    • Description: The setup() function runs once when the program starts, and the loop() function runs continuously. These are the two main functions in every Arduino sketch.
  2. Serial Communication

    • Description: Allows you to send and receive data to and from the computer. You can use Serial.begin() to start communication and Serial.println() to print messages to the Serial Monitor.
  3. 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.
  4. 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.
  5. Delay Function

    • Description: The delay(milliseconds) function pauses the program for the specified amount of time, allowing you to control timing in your projects.
  6. 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.
  7. Controlling Components

    • Description: You have learned how to control LEDs, servos, and push buttons, enabling you to build interactive projects.

Your Project

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.

Requirements

  • 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.

Submission

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!

Clone this wiki locally