Embedded Programming:

Arduino Uno


The Arduino Uno is an open-source microcontroller board based on the Microchip ATmega328P microcontroller and developed by Arduino.cc. The board is equipped with sets of digital and analog input/output pins that may be interfaced to various expansion boards and other circuits.

Input devices

An input device is any equipment that is used to input data and signals to an information processsing system in this case, the Arduino board. An example would be a toggle switch. It inputs either a 0 or 1 into the circuit based on its position. A simple example would be an on-off button.
Here are a few more examples:
  • Push button switch
  • Ultrasonic sensor
  • Motion detectors
  • Light dependent resistors
  • Mounting tape

Output devices

An output device is aany equipment that converts information like binary codes into human-readable form. An example would be the I2C lcd which display prints via the print function.
Here are a few more examples:
  • LED displays
  • Servo motors
  • Stepper motors
  • Relays

Assignment

After searching through the internet for a simple arduino circuit, I choose a cicuit that is able to light up a single LED with a push button. This took me awhile to do eventhough it may seem very simple. This is my first time using Arduino and I must say that I am very happy for the results ive gotten.

The Code:

(Click to download file)

How program works:
After stating the various pins and their outputs and inputs, I created a void loop with an if else statement inside. When I click on the pushbutton, the pushbutton's state will be low, which will in this case make the led state high. This turns on the led. However, as I release the pushbutton, the led turns off. This is due to the else statement which states that unless the button' state is low, the led will not light up.

Circuit in Thinkercad:

Pictures of circuit:

Video of circuit working: