Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 1.77 KB

lab2-arduino.md

File metadata and controls

64 lines (47 loc) · 1.77 KB

Lab 2 - Setting up Arduino

Pre Lab requirments

Starting steps

  • Open arduino IDE
  • Connect via USB cable (A-B usb cable) to your laptop
  • Set connection on tools menu
  • Check that board sub menu is "Arduino Uno"
  • Adjust port sub menu to the arduino comm port.

WARNING

THE ARDUINO SHOULD NEVER RECEIVE VOLTAGE HIGHER THAN 5V. THIS WILL IRREPARABLLY DAMAGE THE BOARD.

Lab Goals

Goal 1 - Blinking Led

  • Run the code on the ide to run the blinkng code: Blink.

  • learn the following functions

> pinMode
> digitalWrite

Goal 2 - Measuring

  • Read a value function with from an analog entry: ReadAnalogVoltage.

  • Validate the reading using the multimeter.

  • learn the following functions:

> analogRead
> Serial.begin
> Serial.println

Goal 3 - Deciding on threshold.

  • Combine the previous two goals on a threshold detector
  • Read an analog input and if higher than 3V turn on the led.
  • Attention the amplitude should be lower than 5v.

Goal 4 - Dimming a light.

  • Activate the PWM with a 1kHz function to dim the led light.

  • Use the code example

  • Verify on the osciloscope the PWM frequency and the width of the square wave.

  • learn the following functions

> analogWrite

Going deeper