Download presentation
Presentation is loading. Please wait.
1
The George Washington University Department of ECE ECE 1010 Intro: Electrical & Computer Engineering
Introducing KIPR Link/Interface and Set-up Continuation of Programming Skills Connecting KIPR Link Making sure connections are fine Introduction to analog sensors Dr. S. Ahmadi Week 2
2
Outline PART I PART II Project Description Programming Exercises
Connecting KIPR Link Hands-on Programming Starting IC Program (Downloading Firmware) Running Programs PART II Introduction to Analog Sensors Project Description
3
PART I: ABOUT THE KIPR WALLABY
5
Connecting the KIPR Wallaby
Connect the Botball to the PC using the USB cable. Type this IP address into your internet browser :8888
6
Click here to write code for your robot
7
Click Add Project
8
Name Project and click create
9
Then click RUN
10
How to run the program on your robot
Click Programs Click the program you want to run Click Run
11
Exercises
12
Sample Beeping Program
/* Program to beep 20 times continuously. */ int main() { int count=0; while(count<=20) beep(); count=count+1; // Incrementing counter } return 0; Extra: Wait half a second between beeps.
13
1
14
Motor control commands
DC motor control commands fd(n); Rotate motor ‘n’ forward bk(n); Rotate motor ‘n’ backwards. motor(n, s); move motor ‘n’ at speed ‘s’ ‘s’ range: -100 ~ +100 ‘s’>0 forward ‘s’<0 reverse off(n); turn off motor ‘n’ ao(); turn off all motors
15
Motor Exercise Procedure
Attach the two motors to the connector wires. Next, attach the wire plugs to KIPR Wallaby ports. Turn the KIPR Wallaby on. Turn on motor 1 using the motor(n,x) command. Make motor 1 alternate between a forward and backward direction. You can change the speed of your motors. For example motor(1,100) means motor 1 is turning at 100 or full speed.
16
Sample Motor Program (Exercise #1)
int main() { printf("Press A button to test motors\n"); while(a_button() == 0); //wait until button A is pressed fd(1); // Motor in port 1 go forward msleep(2000.0); // Sleep for 2 seconds. bk(1); // Motor in port 1 go backward msleep(2000.0); off(1); // Turn motor in port 1 off fd(3); // Motor in port 3 go forward msleep(2000.0); bk(3); // Motor in port 3 go backward msleep(2000.0); off(3); return 0; }
17
Motor Control: Exercise #2
Exercise #1: Motor speed control write IC program to run one motor in three different speeds. Turn motor #1 on drive in slow speed for 3 seconds drive in medium speed for 5 seconds drive in high speed for 3 seconds Stop motor
18
Motor Control: Exercise #3
19
SUMMARY of Main Functions from Week 2
fd(int n); Rotate motor ‘n’ forward bk(int n); Rotate motor ‘n’ backwards. motor(int n, int s); move motor ‘n’ at speed ‘s’ ‘s’ range: -100 ~ +100 ‘s’ > 0 – motor moves forward ‘s’ < 0 – motor reverses/moves backward off(int n); turn off motor ‘n’ ao(); turn off all motors msleep(int x); // Delays execution of next statement for ‘x’ msecs beep(); // Causes the handy-board to beep
20
PART II: INTRO TO SENSORS
21
Analog Sensors Outputs a range of integer values.
Range depends on the signal being sensed. The analog ports are ports 0 – 5. Actual ports that should be used will depend on the sensor being used. The three main analog sensors that we will be using are Light Sensor Optical Rangefinder Sensor Infrared Sensor.
22
Analog Ports
23
Analog Sensor 1: Light Sensor
The light sensor included in the kit, can “sense” lightness and darkness. Connect to analog ports 0-5 Access with function analog10(port#) Analog values range from A low value indicates bright light or close proximity to a light source A high value indicates dark light or far proximity from a light source Enlarged Light Sensor
24
Analog Sensor 2: IR Reflectance Sensor “Top Hat”
The IR sensor included in the kit, can also “sense” lightness and darkness like the light sensor Connect to analog ports 0-5 Access with function analog10(port#) Low values indicate bright light, light color, or close proximity High values indicate low light, dark color, or distance of several inches Sensor has a reflectance range of about 3 inches Enlarged IR Sensor
25
Light Sensor Sample Code
/* Program that measures the reads from the light sensor and displays its output values continuously. */ int main() { int color=0; printf(“Light Sensor Sample Program \n"); while(a_button()==0); // Press Start Button while(1) // Continue infinitely msleep(500); color = analog10(0); // Read “lower deck” analog port 0 printf(“Color is %d \n”, color); // if near 0 – WHITE // if near BLACK } return 0;
26
Project 1 Overview
27
Project Description The aim of this project is to design a robot that moves along a given path, from the Start point, towards the Finish line. The thick black line acts as the guide for the robot to follow. As an optional element to the project, after reaching the finish line, the robot should turn around, and go back along the path it came to the starting point. Robot will be judged on smoothness of journey, and robot design. Each group will have one chance to demonstrate their project to the judges. Therefore, fully test your project before demonstration.
28
Project #1 - Route 2m 2m Finish Start 2m 2m
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.