SlideShare uma empresa Scribd logo
1 de 32
Programming in RobotC Introduction to
Installing RobotC http://robotc.net/ 3.0 Mindstorms License ID: 60857910 Password: S9WY95
Setting Menu Level Open Up the Advanced Options
Connecting Bluetooth
Connecting Bluetooth
Connecting Bluetooth 1234
Connecting Bluetooth
Connecting Bluetooth
Sample Programs RobotC: File -> Open Sample Program Say Watt: http://github.com/SayWatt
First Program Let’s make the robot move! task main() { 	motor[leftMotor] = 100; 	motor[rightMotor] = 100; 	wait1Msec(2000); 	motor[leftMotor] = 0; 	motor[rightMotor] = 0; }
task main() { Tells RobotC:  Start Here!
motor[leftMotor] = 100;motor[rightMotor] = 100; Make leftMotor and rightMotor go forward at full speed.
wait1Msec(2000); Wait 2000 milliseconds. (2 seconds)
motor[leftMotor] = 0;motor[rightMotor] = 0; Make leftMotor and rightMotor stop.
} Tells RobotC: We’re done.
Up Next: Touch Sensor task main() { 	motor[leftMotor] = 100; 	motor[rightMotor] = 100; 	while(SensorValue(touch) != 1) { 		wait1Msec(50); 	} 	motor[leftMotor] = 0; 	motor[rightMotor] = 0; }
while(SensorValue(touch) != 1) { Checks this “Keep looping through this until the value of ‘touch’ equals 1.”
What’s Next? Try to make these changes: Move backwards for 2 sec. 	after the button is pressed. Try turning around and going 	the other way.
Light Sensor task main() {   motor[leftMotor] = 100;   motor[rightMotor] = 100;   while(SensorValue(light) <= 45) {     wait1Msec(50);   }   motor[leftMotor] = 0;   motor[rightMotor] = 0; }
Functions
Basic Functions void startMotors() {   motor[leftMotor] = 100;   motor[rightMotor] = 100; } void stopMotors() {   motor[leftMotor] = 0;   motor[rightMotor] = 0; }
Passing Values void setMotors(int speed) {   motor[leftMotor] = speed;   motor[rightMotor] = speed; } Examples: or setMotors(100); setMotors(0);
Light Sensor Function True / False boolcheckLightSensor() {   if(SensorValue(light) <= 45) {     return true;   }else {     return false;   } }
Line Following Use the light sensor to follow a white line.
Joysticks
3.00 Joystick Bug Open the JoystickDriver.c Change line 123 to: const intkMaxSizeOfMessage = 19;
Analog Sticks joystick.joy1_y1; joystick.joy1_x1; joystick.joy1_y2; …..
Buttons Returns a bool. joy1Btn(1); joy1Btn(2); …
Basic Joystick Code task main() {   while(true) { getJoystickSettings(joystick);     motor[leftMotor] = joystick.joy1_y1;     motor[rightMotor] = joystick.joy1_y2;     wait1Msec(20);   } }
“Joystick Drift”
Fixing Drift intleftMotorValue = joystick.joy1_y1; intrightMotorValue = joystick.joy1_y2; if(abs(leftMotorValue) < 20) { leftMotorValue = 0; } if(abs(rightMotorValue) < 20) { rightMotorValue = 0; }
Wait For Start

Mais conteúdo relacionado

Semelhante a Introduction to RobotC

Project single cyclemips processor_verilog
Project single cyclemips processor_verilogProject single cyclemips processor_verilog
Project single cyclemips processor_verilogHarsha Yelisala
 
5 Cool Things About PLSQL
5 Cool Things About PLSQL5 Cool Things About PLSQL
5 Cool Things About PLSQLConnor McDonald
 
Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Béo Tú
 
2D Plotter Presentation
2D Plotter Presentation2D Plotter Presentation
2D Plotter PresentationMahmoud Kandil
 
Optimal and pid controller for controlling camera’s position in unmanned aeri...
Optimal and pid controller for controlling camera’s position in unmanned aeri...Optimal and pid controller for controlling camera’s position in unmanned aeri...
Optimal and pid controller for controlling camera’s position in unmanned aeri...Zac Darcy
 
Where the wild things are - Benchmarking and Micro-Optimisations
Where the wild things are - Benchmarking and Micro-OptimisationsWhere the wild things are - Benchmarking and Micro-Optimisations
Where the wild things are - Benchmarking and Micro-OptimisationsMatt Warren
 
Basic Unit Testing with Mockito
Basic Unit Testing with MockitoBasic Unit Testing with Mockito
Basic Unit Testing with MockitoAlexander De Leon
 
Oops lab manual2
Oops lab manual2Oops lab manual2
Oops lab manual2Mouna Guru
 
Java căn bản - Chapter6
Java căn bản - Chapter6Java căn bản - Chapter6
Java căn bản - Chapter6Vince Vo
 
Boost statechart library
Boost statechart libraryBoost statechart library
Boost statechart libraryJan Rüegg
 
Optimal and Pid Controller for Controlling Camera's Position InUnmanned Aeria...
Optimal and Pid Controller for Controlling Camera's Position InUnmanned Aeria...Optimal and Pid Controller for Controlling Camera's Position InUnmanned Aeria...
Optimal and Pid Controller for Controlling Camera's Position InUnmanned Aeria...Zac Darcy
 

Semelhante a Introduction to RobotC (20)

Project single cyclemips processor_verilog
Project single cyclemips processor_verilogProject single cyclemips processor_verilog
Project single cyclemips processor_verilog
 
Final pid2
Final pid2Final pid2
Final pid2
 
Java Programming: Loops
Java Programming: LoopsJava Programming: Loops
Java Programming: Loops
 
1 matlab basics
1 matlab basics1 matlab basics
1 matlab basics
 
5 Cool Things About PLSQL
5 Cool Things About PLSQL5 Cool Things About PLSQL
5 Cool Things About PLSQL
 
Operating System
Operating SystemOperating System
Operating System
 
Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014
 
2D Plotter Presentation
2D Plotter Presentation2D Plotter Presentation
2D Plotter Presentation
 
Lab_Presentation
Lab_PresentationLab_Presentation
Lab_Presentation
 
Gans
GansGans
Gans
 
GANs
GANsGANs
GANs
 
Optimal and pid controller for controlling camera’s position in unmanned aeri...
Optimal and pid controller for controlling camera’s position in unmanned aeri...Optimal and pid controller for controlling camera’s position in unmanned aeri...
Optimal and pid controller for controlling camera’s position in unmanned aeri...
 
Using matlab simulink
Using matlab simulinkUsing matlab simulink
Using matlab simulink
 
Using matlab simulink
Using matlab simulinkUsing matlab simulink
Using matlab simulink
 
Where the wild things are - Benchmarking and Micro-Optimisations
Where the wild things are - Benchmarking and Micro-OptimisationsWhere the wild things are - Benchmarking and Micro-Optimisations
Where the wild things are - Benchmarking and Micro-Optimisations
 
Basic Unit Testing with Mockito
Basic Unit Testing with MockitoBasic Unit Testing with Mockito
Basic Unit Testing with Mockito
 
Oops lab manual2
Oops lab manual2Oops lab manual2
Oops lab manual2
 
Java căn bản - Chapter6
Java căn bản - Chapter6Java căn bản - Chapter6
Java căn bản - Chapter6
 
Boost statechart library
Boost statechart libraryBoost statechart library
Boost statechart library
 
Optimal and Pid Controller for Controlling Camera's Position InUnmanned Aeria...
Optimal and Pid Controller for Controlling Camera's Position InUnmanned Aeria...Optimal and Pid Controller for Controlling Camera's Position InUnmanned Aeria...
Optimal and Pid Controller for Controlling Camera's Position InUnmanned Aeria...
 

Último

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Introduction to RobotC