Turn Signal

From Microduino Wiki
Jump to: navigation, search


Outline

Anywhere carSteeringled.jpg

Let's make a turn signal: press the left switch, and the left light is turned on; press the right switch, and the right light is turned on.


Suitable kits: mCookie202, mCookie302, IBC


Module Bill

Module

Module Number Function
mCookie-Core 1 Core board
Battery box 1 Program download and power supply
mCookie-Hub 1 Sensor adapter plate
LED 2 Single-color LED
Crash 2 Crash switch

Other Equipment

  • USB cable*1
  • Sensor cable*4
  • Sensor shell*1
  • Lego or other fixation structure
Anywhere carSteeringled-module.jpg


Module Setup

Anywhere carSteeringled-module—step.jpg
  • Assemble modules and sensors:
    • Stick the red core module, battery base, and green extension module together;
    • Connect the 2 red LEDs to pin 6/7 and 8/9 of Hub respectively;
    • Connect the 2 crash sensors to pin 2/3 and 4/5 of Hub respectively;
    • Insert one end of USB cable into USB upload module, and connect the other to computer;


Programming

Required Program Blocks

Programming Thought

Use "if - do" condition statement to detect which is pressed between the two crash sensors on both sides, and make the corresponding LED flash, ad continue to detect after the LED ends flashing.

Mixly-ctrl-carSteeringled.jpg

Start to Program

1. If the left switch is pressed, the left LED will flash once.
Take the switch of pin 2 as the left switch, and the LED of pin 6 as the left LED; put the flashing(on and off once) program into executed internal program: if the left switch is pressed, the left LED will flash once.

Mixly-ctrl-carSteeringled-code1.jpg

2. If the right switch is pressed, the right LED will flash once
Take the switch of pin 4 as the right switch, and the LED of pin 8 as the right LED; put the flashing program into the executed internal program: if the right switch is pressed, the right LED will flash once.

Mixly-ctrl-carSteeringled-code2.jpg

Test the result
After upload the program, press the left switch, and the left LED will flash; press the right switch, and the right LED will flash.

Anywhere carSteeringled.jpg

Technical Specification


Related Cases


FAQ