Presentation is loading. Please wait.

Presentation is loading. Please wait.

EasyC Programming Workshop January 30, 2008 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp.

Similar presentations


Presentation on theme: "EasyC Programming Workshop January 30, 2008 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp."— Presentation transcript:

1 EasyC Programming Workshop January 30, 2008 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp. Mark.McLeod@ngc.com

2 Agenda FIRST Control System FIRST Control System C Basics C Basics EasyC Environment EasyC Environment EasyC Basics EasyC Basics –Robot Driver Control Demonstration of Basic OI Controls Demonstration of Basic OI Controls –Robot Autonomous Control Demonstration of Dead Reckoning Demonstration of Dead Reckoning

3 FIRST Control System solenoidmotor

4 FIRST Control Elements Hardware Hardware –Robot Controller (RC) User Processor vs. Master Processor User Processor vs. Master Processor PWM, Relay, Digital I/O, Analog, Misc. PWM, Relay, Digital I/O, Analog, Misc. –Operator Interface (OI) –Tether cable / Programming cable –Laptop Programming Programming –C Language Based –Application Programmer Interface (API) –Dashboard (optional)

5 Robot Controller Architecture User Processor User Processor –What we download to –Runs our code –Reads the digital/analog I/O directly Master Processor Master Processor –Controls Disable/Autonomous/Driver modes –Disables OI inputs & most RC outputs –Must hear from User periodically or shuts it down –Master Code Software is updated each year

6 Robot Controller I/O Banner Sensor Touch Sensor Switch Gyroscope Camera Limit Switch Analog Rangefinder Encoder Potentiometer Pressure Sensor Servo SolenoidCompressor Analog Digital Motors Relays Team LEDs TTL

7 Getting Started Tutorials Tutorials –Help -> Tutorials Create/Open an EasyC Project Create/Open an EasyC Project –New Competition Template –Controller Configuration Drag & Drop Editing Drag & Drop Editing Build & Download Build & Download –Loader Setup to select serial/USB port –Online Window to test & check RC config.

8 .hex file Robot Controller Operator Interface Dashboard (optional)Mechanics Prog Button Build & Download

9 Project Controller Configuration Controller Configuration –Set Digital as input or output

10 Function Blocks Add Variables Add Variables Inputs – Digital & Analog I/O Inputs – Digital & Analog I/O Outputs – PWM, Relay Outputs – PWM, Relay Program Flow – C statements Program Flow – C statements RC Control – Drive style (tank, arcade) RC Control – Drive style (tank, arcade) Camera Camera Control – Know status (disable, auto) Control – Know status (disable, auto) User Functions (Initialize, Auto, Operator) User Functions (Initialize, Auto, Operator)

11 Simple Operator Mode While (1) { // From “Program Flow – While” Tank4(1,2,2,2,1,3,2,4,0,1,0,1); // From “RC Control – Tank – 4 motor” }

12 More Complex Operator Mode unsigned char LeftJoystick; // Double click “Variables” while (1) { LeftJoystick = GetOIAInput(1,2); // From “RC Control” if(LeftJoystick > 137 || LeftJoystick < 117) // From “Program Flow” { SetPWM(1, LeftJoystick); // From “Outputs” } else { SetPWM(1, 127); }

13 Simple Autonomous SetPWM(1,200); // From “Outputs” SetPWM(2,55); Wait(10000); // From “Program Flow” (10 secs in milliseconds) SetPWM(1,127); //Be sure to stop the robot at the end SetPWM(2,127);

14 Sample IR Sensor Use While(1) { if (GetDigitalInput(1) == 1) { SetOILED(1,1); //Turn 1 st OI light on SetOILED(3,0); //Turn other OI lights off SetOILED(5,0); SetOILED(7,0); SetPWM(1,200); //Drive the robot SetPWM(2,55); } if (GetDigitalInput(2) == 1) { SetOILED(1,0); //Turn other OI lights off SetOILED(3,1); //Turn 2 nd OI light on SetOILED(5,0); SetOILED(7,0); SetPWM(1,127); //Stop the robot SetPWM(2,127); }

15 More Information Presentation slides at: Presentation slides at: Team358.org Team358.org Questions/Help please email us. Questions/Help please email us.Mark.McLeod@ngc.com


Download ppt "EasyC Programming Workshop January 30, 2008 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp."

Similar presentations


Ads by Google