ARDUINO PROGRAMMING Current Time:


WEEK 9

Arduino Programming


Intro to Arduino

  • Arduino IDE (Integrated Development Environment) is a cross-platform application (runs on Windows, MacOS and Linux) which allows you to enter the source code for your application programming.
  • It uses simple computing language such as C or C++.
  • Simply to say, it splits into 3 parts
    1. Functions
    2. Structure
    3. Variables
  • There are also some references code can be use as example and explaination
  • Arduino References

    Data Type

    Assignment 1 and 2 (without Switch)

    Wiring with LEDs

  • It is IMPORTANT to which port is using as Input or Output as well as 5v input voltage and ground
  • Check whether the component connected correctly(positive to positive ; negative to negative)
  • Would recommend to watch the video which learning arduino in 15 mins as it explains besides the component in arduino, the video also explains about coding which is suitable and easier to understand for begginers to learn
  • Basic coding
    1. Connect the circuit as the image above, once again do check the ground and voltage supply
    2. Under code tab, choose "text" to start your arduino programming.
    3. Loop with different pattern using delay and digitalWrite

    Mistake made
    One mistake i probably made was creating a function without a close bracket or whether have semicolon( ; ) at the end of the line.

    Arduino code for assignment 1 and 2

    Assignment 3 and 4 (With Switch)

    Wiring with LEDs

    Switch Case Coding
    1. Repeat the basic code steps, connections and start programming
    2. Set int count = 0, we can use it as a counter to switch different cases, so if button press, count++ (++ = +1)
    3. Again, loop with different pattern using delay and digitalWrite (create new funtion or define in the functions)
    Rebounce Coding
    1. After count++, place a delay to first, read again whether the switch is pressed or not
    2. If is pressed, it will run "reset" function which it sets as all LEDs are off and count = 0, the delay use in the reset function use is forrebounce purpose.

    Arduino code for assignment 3 and 4