Easyc programming workshop
This presentation is the property of its rightful owner.
Sponsored Links
1 / 15

EasyC Programming Workshop PowerPoint PPT Presentation


  • 171 Views
  • Uploaded on
  • Presentation posted in: General

EasyC Programming Workshop. January 30, 2008 Hauppauge High School SPBLI - FIRST. Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp. [email protected] Agenda. FIRST Control System C Basics EasyC Environment EasyC Basics Robot Driver Control

Download Presentation

EasyC Programming Workshop

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Easyc programming workshop

EasyC Programming Workshop

January 30, 2008

Hauppauge High School

SPBLI - FIRST

Mark McLeod

Advisor

Hauppauge Team 358

Northrop Grumman Corp.

[email protected]


Agenda

Agenda

  • FIRST Control System

  • C Basics

  • EasyC Environment

  • EasyC Basics

    • Robot Driver Control

      • Demonstration of Basic OI Controls

    • Robot Autonomous Control

      • Demonstration of Dead Reckoning


First control system

FIRST Control System

solenoid

motor


First control elements

FIRST Control Elements

  • Hardware

    • Robot Controller (RC)

      • User Processor vs. Master Processor

      • PWM, Relay, Digital I/O, Analog, Misc.

    • Operator Interface (OI)

    • Tether cable / Programming cable

    • Laptop

  • Programming

    • C Language Based

    • Application Programmer Interface (API)

    • Dashboard (optional)


Robot controller architecture

Robot Controller Architecture

  • User Processor

    • What we download to

    • Runs our code

    • Reads the digital/analog I/O directly

  • 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


Robot controller i o

Robot Controller I/O

Motors

Analog

Gyroscope

Servo

Team

LEDs

Analog Rangefinder

Potentiometer

Banner Sensor

Touch Sensor

Pressure Sensor

Switch

Digital

Encoder

Relays

TTL

Solenoid

Compressor

Limit Switch

Camera


Getting started

Getting Started

  • Tutorials

    • Help -> Tutorials

  • Create/Open an EasyC Project

    • New Competition Template

    • Controller Configuration

  • Drag & Drop Editing

  • Build & Download

    • Loader Setup to select serial/USB port

    • Online Window to test & check RC config.


Mechanics

.hex file

Mechanics

Build & Download

Robot Controller

Dashboard (optional)

Operator Interface

Prog Button


Project

Project

  • Controller Configuration

    • Set Digital as input or output


Function blocks

Function Blocks

  • Add Variables

  • Inputs – Digital & Analog I/O

  • Outputs – PWM, Relay

  • Program Flow – C statements

  • RC Control – Drive style (tank, arcade)

  • Camera

  • Control – Know status (disable, auto)

  • User Functions (Initialize, Auto, Operator)


Simple operator mode

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”

}


More complex operator mode

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);

}

}


Simple autonomous

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);


Sample ir sensor use

Sample IR Sensor Use

While(1) {

if (GetDigitalInput(1) == 1) {

SetOILED(1,1); //Turn 1st 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 2nd OI light on

SetOILED(5,0);

SetOILED(7,0);

SetPWM(1,127); //Stop the robot

SetPWM(2,127);

}

}


More information

More Information

  • Presentation slides at:

    Team358.org

  • Questions/Help please email us.

    [email protected]


  • Login