View unanswered posts | View active topics It is currently Wed Sep 23, 2020 4:19 pm

Reply to topic  [ 1 post ] 
My first project--a "puppy" 
Author Message

Joined: Wed Nov 11, 2009 2:36 pm
Posts: 1
Post My first project--a "puppy"
For my first project, I decided to try to make a puppy. The puppy is supposed to drive around in circles until you touch the touchSensor, hence petting it, and will use the sonarSensor to turn around slowly until it stops at the hand that was petting it. I also used small sound bytes to replicate barking and whining.

Here is my code I created:

#pragma config(Sensor, S1,     touchSensor,         sensorTouch)
#pragma config(Sensor, S2,     sonarSensor,         sensorSONAR)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
while (true)


   while(SensorValue(touchSensor) == 0)//a while loop is declared with the touchsensor's value being 0 as it true condition

      motor[motorA] = 75;
      motor[motorB] = -75;

   while(SensorValue(touchSensor) == 1)
     if(SensorValue(sonarSensor) > 20)
      motor[motorA] = 45;
      motor[motorB] = -45;
     } else {
             motor[motorA] = 0;
             motor[motorB] = 0;



Also, here is a video of my "puppy" working.

Wed Dec 09, 2009 2:42 pm
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.