Rotating Billboard 2

From Microduino Wiki
Jump to: navigation, search

Overview

Anywhere Servo advertising2.jpg

Make a billboard where letters can scroll, and the scrolling action of letters and the spinning action of the billboard are synchronous.
Suitable kits: mCookie202 and mCookie302


Module List

Module

Module Number Function
mCookie-Core 1 Core board
Battery base 1 Program download and power supply
mCookie-Hub 1 Sensor adapter plate
Servo 1 Servo
Servo Connector 1 Servo Connector

Other Equipment

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

Module Setup

Anywhere Servo-module—step advertising.jpg
  • Assemble modules and sensors together:
    • Stick the red core module, USB upload module and the green Hub together;
    • Connect the servo connector to pin 6/7 of Hub;
    • Connect the servo to pin 1 (the lower three pins) of the servo connector;
    • Connect the OLED to pin IIC of Hub;
    • Plug one end of USB cable into the USB upload module and connect the other to the computer;

Programming

Required Program Blocks

Programming Thought

Use every time for 128 times (the width of OLED is 128 pixels), set the horizontal position of letters to (0-executions), and map executions from 0-128 to 40-140 (the servo rotates between 40-140°), so that letters rolling reversely at the same time with the servo rotates can be implemented.

Mixly-ctrl-Servo-advertising2.jpg

Start to Program

1. OLED spins to right, and letters move to left.
Variable A is for storing the angle of the servo. Execute the internal program 128 times repeatedly (positive count). Map times of repetition from 0-128 to 40-140 (the servo spins between 40-140°), the servo spins to A°. Display “Welcome to playing mCookie!” on OLED, the X coordinate is 0-I, and the Y coordinate is 40.

Mixly-ctrl-Servo-advertising2-code.jpg

2. OLED spins to left, and letters roll to right.
Execute the internal program for 128 times repeatedly (negative count). The internal program is same with that on the last page.

Mixly-ctrl-Servo-advertising2-code1.jpg

Test the result
After upload, the letters on OLED roll to left, the servo spins from 40 degrees to 140 degrees, and then the letters on OLED roll to right, then the servo spins from 140 degrees back to 40 degrees, and repeat the loop.

Anywhere Servo advertising2.jpg



Q: The billboard rotates too slowly, how to make it quicker?
A: The simplest way is changing the rotation speed of the servo, or course, you can also change the step length of every time program block. The previous every time program block is executing once for each step, now, change it into executing once for each 4 steps.

Change the every time into executing once for each -4 steps. Execute once for each step, count from 0-128, and the internal program is executed 128 times totally before. Now, execute once for each 4 steps, count from 0-128, the internal program is executed 32 times totally.

Mixly-ctrl-Servo-advertising2-code3.jpg

Technical Specification

  • For more about Servo, please refer to Servo.

Relative Cases

FAQ