Seesaw

From Microduino Wiki
Jump to: navigation, search

Overview

Anywhere line seesaw.jpg

Make a seesaw which can detect the ground and avoid touching it.
Suitable kit: mCookie302


Module List

Module

Module Number Function
mCookie-Core 1 Core board
Battery box 1 Program download and power supply
mCookie-Hub 1 Sensor adapter plate
Servo 1 Servo
Servo Connector 1 Servo Connector
Line Finder 2 Detect objects

Other Equipment

  • USB cable*1
  • Sensor cable*3
  • Sensor shell
  • Building blocks or other fixation structures
Anywhere don't touch me-module.jpg

Modules Setup

Setup

Anywhere don't touch me-step.jpg
  • Assemble modules and sensors together:
    • Stick red core module, battery base and green extension module together;
    • Connect the Servo Connector to pin 6/7 of Hub;
    • Connect the Servo to pin 1 (the lower three pins) of Servo Connector;
    • Connect Line Finder to pin A0/A1 and A2/A3 of Hub;
    • Plug one end of USB cable into the battery base, and connect the other to the computer;

Programming

Required Program Blocks


Programming Thought

If the left end of the seesaw is not close enough to the ground, the seesaw will keep spinning to left most. Similarly, if the right end of the seesaw is not close enough to the ground, the seesaw will keep spinning to right most.

Mixly-ctrl-line seesaw.jpg

Start to Program

1. The seesaw spins to left
Variable servo is for saving the angle of servo.
If the Line Finder of pin A0 is larger than 100 (the left end of the seesaw is not close enough to the ground), execute that repeatedly. Variable servo increases 1. The servo spins to angle servo (the left end of the seesaw lowers).

Mixly-ctrl-line seesaw-code.jpg

2. The seesaw spins to right
If the Line Finder of pin A2 is larger than 100 (the right end of the seesaw is not close enough to the ground), execute that repeatedly.
Variable servo reduces 1. Servo spins to angle servo (the right end of the seesaw lowers).

Mixly-ctrl-line seesaw-code1.jpg



Test the result
You can see the seesaw spins automatically.

Anywhere line seesaw.jpg



Q: Once starting, it can’t stop. How to make it stop 3s after running 5 times and then run again.
A: Execute running code 5 times with every time program block, and add a 3s delay to that.

Execute the internal program (seesaw actions) 5 times repeatedly. The internal program is: seesaw actions.
Delay 3s (seesaw stops for 3s after running 5 times for the substitution of players).

Mixly-ctrl-line seesaw-code2.jpg

Technical Specification

Relative Cases

FAQ