Revolution Indicator

From Microduino Wiki
Revision as of 06:27, 2 June 2017 by Fengfeng (talk) (Start Programming)
Jump to: navigation, search

Overview

Anywhere turnspeed.jpg

Today, we will make a revolution indicator, which can represent the revolution with the color of the indicator light, the brighter the light is, the faster the motor rotates.

Module List

Module

Module Number Function
mCookie-Core 1 Core board
Battery 1 Program download and power supply
mCookie-Hub 1 Sensor adapter plate
mCookie-OLED 1 Display
Motor driver 1 To driver motor
Potentiometer 1 To detect rotation
N20 gear motor 1 Rotate continuously
ColorLED 1 Color LED

Other Equipment

  • USB cable*1
  • Sensor cable*3
  • Sensor shell
  • Building blocks or other fixation structures
Anywhere turnspeed-module.jpg

Module Setup

Setup

Anywhere turnspeed-step.jpg
  • Assemble modules and sensors together:
    • Stick the core, battery, OLED and the extension module together;
    • Connect the color LED to pin 4/5 of Hub;
    • Connect the potentiometer to pin A0/A1 of Hub;
    • Connect the motor to pin 1A/1B of motor module;
    • Stick the red core, green extension module, motor module to the yellow battery base;
    • Plug one end of the USB cable into the battery base, and connect the other to the computer.

Programming

Programming Thought

We can just correspond the set value of the potentiometer to the brightness of the colorLED.

Mixly-ctrl-turnspeed.jpg

Required Program Blocks


Start Programming

Motor begin ColorLED prepare, connect it to pin 4 of Hub. Variable A is for storing the speed of the motor. Save the value of the rotating potentiometer in A. Map A from 0-1023 to 0-255. Set the brightness of the color LED to A. Set the rotation speed of the motor of interface 1A1B to A.

Mixly-ctrl-turnspeed-code.jpg



Test the result
Turing the potentiometer can control the speed of the motor, the faster the motor, the brighter the LED.

Anywhere turnspeed.jpg



Q:It is not obvious only showing the rotation speed through the brightness of light, so can I add an OLED?
A: No problem.

Display A on OLED.

Mixly-ctrl-turnspeed-code1.jpg

Technical Specification

Related Cases

FAQ