1 / 15

LEGO Mindstorms NXT

LEGO Mindstorms NXT. SOURCES:. Carnegie Mellon Dacta Lego Timothy Friez Miha Štajdohar miha.stajdohar@fri.uni-lj.si. Sen sors. Sensors and Motors. Four sensor ports Sonar Sound Light Touch Three motor ports Each motor includes rotation counter. Touch Sensors.

elon
Download Presentation

LEGO Mindstorms NXT

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LEGO Mindstorms NXT SOURCES: Carnegie Mellon Dacta Lego Timothy Friez Miha Štajdoharmiha.stajdohar@fri.uni-lj.si

  2. Sensors

  3. Sensors and Motors • Four sensor ports • Sonar • Sound • Light • Touch • Three motor ports • Each motor includes rotation counter

  4. Touch Sensors • Education kit includes two sensors • Much more robust than old RCX touch sensors

  5. Light Sensor • Reports light intensity as percentage • Two modes • Active • Passive • Practical uses • Identify intensity on paper • Identify lit objects in dark room • Detect shadows

  6. Sound Sensor • Analogous to light sensor • Reports intensity • Reputed to identify tones • We have little experimented with this • Practical uses • “Clap” to signal robot

  7. Ultrasonic (Sonar) Sensor • Reports distances • Range: about 5 cm to 250 cm • In practice: • Longer distances result in more missed “pings” • Mostly reliable • Occasionally gets “stuck” • Moving to a new location helps in receiving a sonar “ping”

  8. Using Joysticks • To control your robot using a joystick axis or a button, use these functions • frcRF[port] – gets the value from a joystick axis • [port] – p1_y, p1_x, p1_wheel, … p2_x,…p3_x, etc. • frcOIJoystickButtons[port] • [port] – oiButtonPort1Button1 through oiButtonPort4Button4

  9. Using Loops • A Loop will help a portion of your code execute repeatedly, until told to stop. while(true == true) { motor[port1] = frcRF[p1_y]; motor[port2] = frcRF[p2_y]; } • This code will cause the motors to respond to the joystick values forever. • The loop reads (while true is equal to true)

  10. Analog Sensors • Very easy to read analog sensor values • SensorValue[port] • [port] = in1,in2,in3 … in16 while(SensorValue[in1] < 10) { motor[port1] = frcRF[p1_y]; motor[port2] = frcRF[p2_y]; } • This program will run until an analog sensor on port 1 sees a value of less than 10. • Analog sensor values can range from 0 to 1023

  11. Digital Sensors • Digital sensors are a little more complex • First you have to decide if you want the sensor port to be an input or output • frcDigitalIODirection[port] = condition; • port – pio1, pio2, pio3, … pio18 • condition – dirInput or dirOutput • Second you have read or assign the value • frcDigitalIOValue[port] • If an input, this will read the value (either a 1 or 0) • If an output, you can assign the value using a 1 or 0. • frcDigitalIOValue[port] = 1; // turns on the digital output port

  12. ROBOTC for IFI – Version 1.14 • New ROBOTC version • Has built in support for: • encoders, • accelerometer, • gyro sensor, • OI LEDs • and more! • Make sure to upgrade!

  13. IR Board Review • Rule Clarification from Team Update #3 • 4 Signals Allows • 4 Signals = 4 actions • Signals must repeat when the same button is pressed.

  14. Operator Interface LEDs • 11 LEDs installed on Operator Interface • 7 Green • 4 Red • User Controllable with ROBOTC

  15. Controlling the LEDs • New ROBOTC function • frcOILEDs[LED] = true or false • Examples • frcOILEDs[oiLEDPWM1_Green] = true; • Turns on PWM1 Green LED • frcOILEDs[oiLEDPWM1_Green] = false; • Turns off PWM1 Green LED

More Related