top of page

Search Results

285 results found with an empty search

  • Junior Robot Wars Mine 3 Dec 2020

    < Back Junior Robot Wars Mine 3 Dec 2020 This is the mine program for the Junior Robot Wars Competition 3 Dec 2020. Program --- Junior Robot Wars Mine Program 3 Dec 2020 --- prog_vars = d/hits 0 d/hit_result 0 d/health 10 d/flashes 0 d/died 0 prog_vars. prog_start = "Mine Start" coff repeat 10 -> tg c2|d100 -- Setup the bumper pins A1 & A2 btp a1 do_boom btp a2 do_boom hled prog_start. prog_loop = patdog prog_loop. do_boom = --- The mine is triggered work out the health or damage. --- /flashes 0 -- Get a new random number between -6 and 6. rand -6 6 -> /hit_result -- Update the health var add /health /hit_result -> /health -- Flash for neg /hit_result ie deduct health any /hit_result < 0 -> /flashes 2 -- Count no of hits inc /hits print "T /hits TR /hit_result H /health F /flashes" show_hit_color /hit_result /flashes do_boom. show_hit_color /hit_color 0 /hit_flashes 0 = -- All c off coff -- Get abs version of color abs /hit_color -> /hit_color hled repeat /hit_flashes -> ant /hit_color -> = 1 -> sled a3 6 /hit_color 0 255 0 = 2 -> sled a3 6 /hit_color 0 255 255 = 3 -> sled a3 6 /hit_color 255 255 0 = 4 -> sled a3 6 /hit_color 255 0 255 = 5 -> sled a3 6 /hit_color 0 0 255 = 6 -> sled a3 6 /hit_color 0 255 0 -> hled ant. d500 hled repeat. show_hit_color. prog_stop = coff ant /died -> = 1 -> "Died Hits"|c1 1 = 2 -> "Died Health"|c3 1 -> c2 1 ant. rstb prog_stop.

  • Age Calculator Extended

    < Back Age Calculator Extended This program is the same as the "Age Calculator Program", except that it prompts the user for the current year and their birth year. It then takes the persons birth year and the current year and calculates their age, and works out their age if they were born 10 years earlier. Program --- Variables Program Example 2 Create some variables and set their values. --- prog_vars = d/name "Fred" -- name text var with default value d/birth_year 1972 -- year of birth d/current_year 2020 -- the current year d/age 0 -- age in years d/message1 "If you were born 10 years earlier" prog_vars. prog_start = print " -------------- " print "Age Program Begin 2" prog_start. prog_loop = -- Get the current year from the user print "Enter the current year? " getline -> /current_year -- Get their birth year print "Enter your birth year? " getline -> /birth_year -- Work Out their age sub /current_year /birth_year -> /age print "Hi /name you are /age years old" -- Subtract 10 years from their birth year and recalc. sub /birth_year 10 -> /birth_year print "New birth year /birth_year" -- Work Out their newage sub /current_year /birth_year -> /age -- Use /message1 to hold the message so the lines not too long. print "/message1 you would be /age years old" print "Done exiting now!" exitprog prog_loop. prog_stop = exitprog prog_stop.

  • Any and All Numbers Test

    < Back Any and All Numbers Test This program tests the any and all instructions with floating point and integer numbers. Program --- Any and All Numbers Test Program --- prog_vars = d/pin1 0 d/pin2 1 d/float1 12.5 d/float2 3.141 d/int1 10 d/int2 0 d/pin_no 0 d/text1 "Jack" d/text2 "Jill" prog_vars. prog_start = print " -------------- " print "all statement test program" prog_start. prog_loop = -- Test 1 Should be TRUE ie /pin_no != 1 /pin1 0 /pin2 1 /pin_no 2 all /pin_no != 1 -> print "Test 1 TRUE CORRECT" else print "Test 1 FALSE WRONG" exitprog enda. -- Test 2 Should be FALSE ie /text1 not = to /text2 all /text1 = /text2 -> print "Test 2 TRUE WRONG" else print "Test 2 FALSE CORRECT" exitprog enda. -- Test 3 Should be TRUE ie /text1 is != /text2 all /text1 != /text2 -> print "Test 3 TRUE CORRECT" else print "Test 3 FALSE WRONG" exitprog enda. -- Test 4 Should be TRUE ie /text1 is "JacK" all /text1 = "Jack" -> print "Test 4 TRUE CORRECT" else print "Test 3 FALSE WRONG" exitprog enda. -- Test 5 Should be TRUE ie /float1 = 12.5 all /float1 = 12.5 -> print "Test 5 TRUE CORRECT" else print "Test 5 FALSE WRONG" exitprog enda. -- Test 6 Should be TRUE ie /float1 > /float2 all /float1 > /float2 -> print "Test 6 TRUE CORRECT" else print "Test 6 FALSE WRONG" exitprog enda. prog_loop. prog_stop = print "Bye" prog_stop.

  • Servo Claw Test

    < Back Servo Claw Test This simple program uses two servos to control a simple claw where the servo on pin a1 move the claw uyp and down and the servo on a2 opens and closes the claw. A set of 5 RGB smart LEDs is connected to pin a3 and randomly change color. Program --- Servo Arm Test Program --- prog_vars = d/count 0 d/arm_pos 0 d/claw_pos 0 d/total_leds 5 d/led_no 0 d/red 0 d/green 0 d/blue 0 prog_vars. prog_start = "Robot Arm Program" svp a1 0 svp a2 20 sled a3 /total_leds 0 /red /green /blue prog_start. prog_loop = change_led_colors repeat 1 -> svt a1 0 90 10 svt a2 0 100 10 d50 repeat. change_led_colors repeat 1 -> svt a1 1 90 10 svt a2 0 100 10 d50 repeat. change_led_colors prog_loop. change_led_colors = repeat 25 -> -- Set each color to a random value rand 0 255 -> /red rand 0 255 -> /green rand 0 255 -> /blue sled a3 /total_leds /led_no /red /green /blue dly 25 -- Inc to the next LED and then start again. any /led_no >= 6 -> /led_no 0 else inc /led_no enda. repeat. change_led_colors. prog_stop = "Bye" prog_stop.

  • Motor and Drive Commands

    < Back Motor and Drive Commands allstopon - STOP ALL MOVEMENT Purpose This stops all movement of the robot and puts it in a safe mode. Syntax allstopon Notes This command overrides ALL other commands that would normally be able to induce some kind of movement in the robots drive system. The ONLY way to leave all stop on mode is to run the allstopoff command. allstopoff - Leave all stop on mode. Purpose This causes the robot to leave all stop on mode. Syntax allstopoff bmd - The direction of BOTH motors Purpose Allows the direction of movement of both drive motors to be set at the same time. Syntax bmd dir Arguments dir 0 = Forwards 1 = Reverse. bms - Set the speed of both drive motors Purpose This sets the speed of both drive motors to the same value. Syntax bms value Arguments value -100 to 100 Where: -100 full reverse 0 stop 100 full forward Pushers No Returns Nothing Examples bms 0 STOP bms 50 Half forward bms -50 Half back Channels & Vars Channel 150 both motor speed 160 left motor speed 170 right motor speed Notes This is for robots with motor drives. cbst - Cold start boost for the drive motors Purpose This is an extra duty cycle added to the motors speed when its starting from stand still. Syntax cbst value Arguments value 0 to 1000 This is a duty cycle. Examples cbst 100 Set to 100 Notes This is for robots with motor drives. dmlp - Set Left Drive Motor Esp32 Pin no Purpose This is the pin on the esp32 to use for the left drive motors pwm. Syntax dmlp pin Arguments pin The pin no on the esp32 to use. Notes This is for robots with motor drives. Don’t use unless you know what you are doing. dmrp - Set Right Drive Motor Esp32 Pin no Purpose This is the pin on the esp32 to use for the right drive motors pwm. Syntax dmrp pin Arguments pin The pin no on the esp32 to use. Notes This is for robots with motor drives. Don’t use unless you know what you are doing. dslimit - Disable Steering Limit Checking Purpose This allows the steering limit switch checking to be enabled and disabled on robots using a linear actuator with limit switches for steering. Syntax dslimit value Arguments value 0 = Don’t disable 1 = Disable Pushers No Returns Nothing Examples dslimit 0 Don’t disable steering limit switches dslimit 1 Disable steering limit switches Notes This should only be used for testing. faster - Pulse the drive motors forwards a little. Purpose This will briefly pulse both drive motors in the forwards direction a little and then turn them off. Syntax faster Examples faster Move robot forwards a little left - Pulse the robot to the left Purpose On a robot with motor drives fitted this command will cause the robot to turn a little to the left. Syntax left Examples left Turn slightly to the left. Notes This is for robots with motor drives. lmd - Set Left Drive Motors Direction Purpose Set the direction of travel of the left drive motor. 0 = forward Syntax lmd dir Arguments dir 0 = forward 1 = reverse 1 = reverse lmo - Set Left Drive Motors Offset Purpose This is added to the motors speed at a low level to compensate for differences in the motors. Syntax lmo offset Arguments offset The duty cycle offset between 0 and 1000. lms - Set the speed of the left drive motor Purpose This sets the speed of the left drive motor. Syntax lms value Arguments value -100 to 100 Where: -100 full reverse 0 stop 100 full forward Pushers No Returns Nothing Examples lms 0 STOP lms 50 Forward half lms -50 Back half Channels & Vars Channel 150 both motor speed 160 left motor speed Notes This is for robots with motor drives. lmt - Left motor start threshold Purpose This is the min speed value at which the left motors wheels will turn. Range 0 to 100. Syntax lmt value Arguments value 0 to 100 Examples lmt 25 Channels & Vars Channel 165 Notes This is for robots with motor drives. right - Pulse the robot to the right Purpose On a robot with motor drives fitted this command will cause the robot to turn a little to the right. Syntax right Examples right Turn slightly to the right. Notes This is for robots with motor drives. rmd - Set Right Drive Motors Direction Purpose Set the direction of travel of the right drive motor. 0 = forward Syntax rmd dir Arguments dir 0 = forward 1 = reverse rmo - Set Right Drive Motors Offset Purpose This is added to the motors speed at a low level to compensate for differences in the motors. Syntax rmo offset Arguments offset The duty cycle offset between 0 and 1000. rms - Set the speed of the right drive motor Purpose This sets the speed of the right drive motor. Syntax rms value Arguments value -100 to 100 Where: -100 Full reverse 0 STOP 100 Full forwards Examples rms 0 rms 50 rms -50 Channels & Vars Channel 150 both motor speed 170 right motor speed Notes This is for robots with motor drives. rmt - Right motor start threshold Purpose This is the min speed value at which the right motors wheels will turn. Range 0 to 100. Syntax rmt value Arguments value 0 to 100 Examples rmt 25 Channels & Vars Channel 175 Notes This is for robots with motor drives. rstdv - Reset the motor drive system Purpose Resets the drive system to the way it is when the JackBord is turned on. Syntax rstdv Examples rstdv sbms - Set the speed of both drive motors to different values Purpose This sets the speed of both drive motors to the different values in the same command. Syntax sbms left right Arguments left Speed of the left motor. -100 to 100 Where: -100 full reverse 0 stop 100 full forward right Speed of the right motor. -100 to 100 Where: -100 full reverse 0 stop 100 full forward Pushers No Returns Nothing Examples sbms 0 0 Stop sbms 25 50 Left turn sbms 50 25 Right turn sbms 20 20 Forwards Channels & Vars Channel 150 both motor speed 160 left motor speed 170 right motor speed Notes This is for robots with motor drives. sdmct - Set the JackBord drive motor controller type Purpose Set the type of motor being used on the robots drive system. Options are: Type Description 0 NO motor drive installed. 1 Normal MOSFET mode 2 DRV8833 H-bridge 3 L298N H-bridge 4 BTS7960B H-bridge 5 Mobility scooter drive using MCP4161 Digital Potentiometer 6 Single Front Wheel Drive on, front. Connected to the L298 H-bridge Output 2. Syntax sdmct value Arguments value Drive type type, see above. Examples sdmct 2 Set DRV8833 H-bridge type. Notes This is for robots with motor drives. sdtur - s et default turn urgency Purpose Set the default turn urgency Syntax sdtur value Arguments value 1 to 50 Examples sdtur 10 Set default turn urgency to 10 setstmax - Set the Maximum Safe Operating Speed for the robot Purpose This allows a safe maximum speed to be specified and it will be enforced automatically. Syntax setstmax speed Arguments speed -100 to 100 Where: -100 full reverse 0 stop 100 full forward Notes This is for robots with motor drives. The limit set here is automatically enforced by the drive system. setstmin - Set the Minimum Safe Operating Speed for the robot Purpose This allows a safe minimum speed to be specified and it will be enforced automatically. Syntax setstmin speed Arguments speed -100 to 100 Where: -100 full reverse 0 stop 100 full forward Notes This is for robots with motor drives. The limit set here is automatically enforced by the drive system. slower - Pulse the drive motors backwards a little. Purpose This will briefly pulse both drive motors in the reverse direction a little and then turn them off. Syntax slower Examples slower Move robot backwards a little ssv - Set Speed Step Value Purpose Set the amount by which the speed of the drive motors will be changed by other commands such as turn. Syntax ssv value Arguments value 1 to 50 Pushers No Returns Nothing Examples ssv 10 Set to 10 Notes This is for robots with motor drives. straight - Drive in a straight line Purpose Causes the robot to drive in a straight line. Syntax straight stop - Stop both of the robots drive motors Purpose Use this to bring the robot to a halt. Syntax stop Examples stop Halt the robot Notes This is for robots with motor drives. strpw - Set the linear actuator pulse width in milli secs Purpose This sets the width of the pulses used to move linear actuators attached to the JackBord via an L298 H-bridge. The shorter the pulse the slower and more precise the control is. Syntax strpw value Arguments value Pulse width in milli-seconds between 1 and 1000ms. Examples strpw 200 Set the pulse width to 200ms Notes This is for robots with motor drives. strtype - Set the steering type Purpose Set the type of steering being used on the robots drive system. Options are: Type Description 0 Normal differential drive 1 Rack and pinion steering 2 Single front steering wheel 3 L298 Linear Actuator ie Beach Robot. On L298 h-bridge motor no 1. Syntax stur value Arguments value Steering type, see above. Pushers No Returns Nothing Examples strtype 0 Set differential steering Notes This is for robots with motor drives. stur - Set turn urgency Purpose This is the increment used when turning. The higher the value the more aggressive turning will be. Syntax stur value Arguments value Turn urgency 1 to 500. This is a duty cycle. Pushers No Returns Nothing Examples stur 200 Set the turn urgency to 200 Notes This is for robots with motor drives. tgdir - Toggle the direction of travel. Purpose This toggles the current direction of travel of the drive motors. Syntax tgdir tsf - Set turn speed factor Purpose This is the increment used when turning. The higher the value the more aggressive turning will be. Syntax tsf value Arguments value 1 to 50 Pushers No Returns Nothing Examples tsf 10 Set the turn speed factor to 10. Notes This is for robots with motor drives. turn - Turn the robot left or right Purpose Provides a means of steering a robot using values in the range: -100 Full left turn 0 Straight 100 Full right turn The exact limits for left and right are set using the minleft and minright commands. Syntax turn value Arguments value -100 Full left turn 0 Straight 100 Full right turn Examples turn 0 Go straight turn -10 Soft left turn turn 90 Hard right turn Channels & Vars Channel 153 Notes This is for robots with motor drives. vd View - drive system status Purpose View the status of the motor drive system. Syntax vd

  • Korahs Random Lights

    < Back Korahs Random Lights This program will randomly flash 5 LEDs attached to Port C using a random number to decide which LEDs are lit. Program --- Korahs Random Lights Program This program will randomly flash 5 leds attached to port C using a random number to decide which LEDs are lit. --- prog_vars = -- Holds the random number d/random 0 d/count 0 prog_vars. prog_start = print "Korahs Random Lights Program" /random 0 prog_start. prog_loop = -- main program loop -- Increase the /count by 1 inc /count -- Get a new random number between 0 and 6. rand 0 6 -> /random print "Count /count rand no /random" -- Use the ant the determine which LED we should light -- up based upon the random number. -- A 6 will turn them all off. ant /random -> = 1 -> c1 1 = 2 -> c2 1 = 3 -> c3 1 = 4 -> c4 1 = 5 -> c5 1 -> coff ant. -- Check if we shoukd exit. any /count > 1000 -> exitprog prog_loop. prog_stop = print "Bye" prog_stop.

  • Sensors - Sound Detection

    < Back Sound Detection Use the simple sound detector module to determine if there is sound above a pre-set threshold. In this exercise we use a simple on/off sound module to detect sounds. Use the simple sound detector module to determine if there is sound above a pre-set threshold. The threshold is set by using a small Philips screw driver to adjust the square blue variable resistor on the lower right side of the module. The output on the modules OUT pin is normally 5V when there is no sound. When a sound is detected it will drop to 0V and this is how the JackBord can detect sounds. Connect the sound sensor to Port A1, the Port A 5V supply and grounds of the JackBord as shown in the table below. Note the names of the pins on the detector module and the corresponding pins they connect to on the JackBord. When connected correctly it should look like this: Testing: With the module attached as above and the JackBord turned on enter the following command: btp a1 tg d1 When run this command treats the sound module as a button input. Each time the module detects a sound its output goes low, when there is no sound it goes high. Also the red led on the module will light up when it detects a sound. If the module does not seem to detect any sound try adjusting the blue variable resistor a little and try again. Or if it seems to be over sensitive to sound try adjusting the sensitivity down. Table of OUT values for the sound sensor module. Previous Next

  • Combined Any All Example

    < Back Combined Any All Example In this example we have a car and our program has to check that, before the driver can move the car, the following conditions must be met: Condition OK Value Seatbelt is on 1 Doors closed 1 The car cannot be driven if the above are not all 1. But we also have an emergency option. This is normally 0 and is 1 in the event of an emergency, in which case the car can still be driven even if the other conditions are not met. Program --- Combined Any All example. To be allowed to drive the car the /belt and /doors vars must be 1. But if the /emergency var is 1 we can then drive regardless of the /belt or /doors variables value. --- prog_vars = d/emergency 0 d/belt 0 d/doors 0 -- 1 = NO 2 = YES can drive d/drive_ok 0 -- Test Message Array d/test_message[3] "" prog_vars. prog_start = pclear -- Set the two test messages. /test_message[1] "Cant Drive" /test_message[2] "Can Drive" -- Stop by default /drive_ok 0 print "Car Drive Example" prog_start. prog_loop = -- Test 1 > ALL OK Can drive /belt 1 /doors 1 /emergency 0 do_drive_test "Test 1 Result /drive_ok /test_message[/drive_ok]" -- Test 2 > Cant drive no belt /belt 0 /doors 1 /emergency 0 do_drive_test "Test 2 Result /drive_ok /test_message[/drive_ok]" -- Test 3 > Can drive despite no belt & doors because -- /emergency is 1 /belt 0 /doors 0 /emergency 1 do_drive_test "Test 3 Result /drive_ok /test_message[/drive_ok]" exitprog prog_loop. do_drive_test = -- Test all of the conditions and set the /drive_ok var -- with the result. any /emergency = 1 all /belt = 1 /doors = 1 -> -- CAN drive /drive_ok 2 else -- CANT drive /drive_ok 1 enda. do_drive_test. prog_stop = print "Done exiting now!" prog_stop.

  • PIR Sensor

    < Back PIR Sensor ​ Program --- Pir sensor program --- prog_vars = d/senout 0 d/prev 0 prog_vars. prog_start = bms 0 gt a1 prog_start. prog_loop = -- main program loop /senout /a1 any /prev = /senout -> patcat else print "out /senout" enda. any /a1 = 0 -> bms 50 any /a1 = 1 -> bms 0 /prev /senout prog_loop. prog_stop = print "Bye" prog_stop.

  • Plot a Tan Wave

    < Back Plot a Tan Wave Plots a tan wave with the lbar command. Program --- Plot a tan wave with the plot command. --- prog_vars = d/angle 0.0 d/Xpos 0 d/raw_tan 0.0 d/tan_value 0.0 prog_vars. prog_start = pclear ptl 10 0 ^ts=24^tc=blue^ "Plot a Tan wave" prog_start. prog_loop = -- Calc tan of the abgle tan /angle -> /raw_tan -- Scale the tan wave to fit. mapf -1 1 0 50 /raw_tan -> /tan_value -- Plot the Tan wave. plot 10 50 ^t1n=TAN^xdp=100^xp=/Xpos^v1=/tan_value^ inc /angle 0.1 -- 0.1 best -- Check if we should exit. any /Xpos > 100 -> exitprog inc /Xpos prog_loop. prog_stop = print "Good bye" prog_stop.

  • Store Light Readings in an Array

    < Back Store Light Readings in an Array Get voltage readings from a light dependent resistor (LDR) light sensor and store in an array called ldr. Next we plot the readings stored in the array. The store_data task collects the readings and stores them the plot_data task plots them. The LDR is attached to +3v and a 100K resistor is below it. Program --- Get voltage readings from a light dependent resistor (LDR) light sensor and store in an array called ldr. Next we plot the readings stored in the array. The store_data task collects the readings and stores them the plot_data task plots them. --- prog_vars = d/ldr[1000] 0 prog_vars. prog_start = print "Plot ldr data" -- Setup the LDR sensor on Port B1 -- Range is 0 to 100 gvr b1 0 100 -- Setup USER led pwm d1 0 prog_start. prog_loop = store_data 50 plot_data 50 exitnow prog_loop. store_data /no_of_points 0 = -- Get light readings from the ldr and store -- in the /ldr array print "Get /no_of_points of light readings" d/point_no 0 -- Get the ldr readings and store repeat /no_of_points -> -- Store the new value. /ldr[/point_no] /b1 print "/point_no /b1" -- Plot the sine value we just stored -- tbar . /b1 0 25 "/point_no /b1" -- Set USER brightness based on plot value pwm d1 /b1 inc /point_no repeat. store_data. plot_data /plot_points 0 = -- Plot the ldr stored in the /ldr array. print "Plot /plot_points Stored in LDR data Array" d/plot_no 0 pwm d1 0 repeat /plot_points -> -- Plot the ldr data tbar . /ldr[/plot_no] 0 25 "B /plot_no /ldr[/plot_no]" -- print "B /plot_no /ldr[/plot_no]" -- Set USER brightness based on plot value pwm d1 /ldr[/plot_no] inc /plot_no repeat. plot_data. prog_stop = print "Good bye" prog_stop.

  • Sensors - HC-SR505 Mini PIR Infrared Motion

    < Back HC-SR505 Mini PIR Infrared Motion HC-SR505 is an infrared module which detects the movement of a person or animal, at distances of up to 3m. HC-SR505 is an infrared module which detects the movement of a person or animal, at distances of up to 3m. When it detects movement the output pin will go high to 3V. If, after the detection the object is no longer there, it's output will go back low after about 8 to 10 seconds. It uses an infrared sensor to detect movement in front of the sensor with a beam width of about 100 degrees. How the Sensor Works The output pin is normally low and will go high when a person or an animal crosses the sensors beam. This beam is like a 100deg wide fan centered along the axis of the sensor looking out from the white dome. Note: Once the sensor is triggered it will take about 8 to 10 seconds for it to reset once the beam is clear. Sensor Pins The pins of the sensor are shown below. Note this is the top view, you can check this by looking for the two yellow capacitors towards the bottom of this picture. The best wire color is included so you get into the habit of using consistent wires for the ground and power supply as this will save you a lot of trouble in the future. Connecting the Jumpers to the Sensor First we will connect the jumpers to the sensor. Then we will connect it to the JackBord. The sensor needs 5V to work. It needs 3 female to female jumper wires to connect to the JackBord as shown in the picture below. The output of the sensor can be connected to any of the pins on ports A, B or C. Parts Needed: You will need the following items: The sensor x3 female to female jumper wires, 10cm or more Connection Steps: Follow these steps to avoid damage to the JackBord or the sensor. The jumper wires are connected to the sensor as shown in the picture, note in our case we have used a red jumper for the 5V power, a purple one for the output and a green one for ground. Connect yours by following these steps: Turn off the JackBord. Connect a red female jumper to the rightmost pin of the sensor (note: this is with the sensor facing up as in the picture above). Connect a green or black jumper wire to the far left ground pin. Connect a jumper for the output to the center pin. In our case we used a purple jumper. Check your sensor connections with the picture below. Here we have used a red wire for 5V, a purple one for the output and a green one for ground. Connecting the Sensor to the JackBord Now that we have the jumpers connected to the sensor we need to connect the other ends to the JackBord. These connections are listed in the table below. Connection Steps: We are going to connect the sensor to port Pin A1 on port A. We will also use port A's ground and 5V power line to keep things tidy. Follow these steps to connect the sensor to the JackBord: Turn off the JackBord Connect the green ground wire from the sensor to the ground pin on port A. Connect the red power wire from the sensor to the +5V pin on port A. Connect the purple output wire from the sensor to port pin A1 on the JackBord. Once you have made the connections check them against the picture below and make sure they match. Compare your connections with these pictures. Once you are sure they are ok carry on to the usage instructions below. Using the Sensor with the JackBord Turn on the JackBord and go to the dashboard. We can use the button press and release commands, with this sensor so we can get the JackBord to take certain actions in response to the state of the sensor. As stated above, when an object is detected the output will go high (3V) and once the object leaves the sensors view the output will go back to being low (0V). Because this is the opposite of a buttons operation we need to use the button release command btr to deal with the detection event and the button press btp command to deal with the non detection event. Example Commands: The commands below setup the sensor on port A1 so that when an object is detected the USER LED on the front of the JackBord will be turned on, this is accomplished by the btr command. The USER LED will turn off once the object leaves the field and this is because of the btp command. btr a1 l1 1 btp a1 l1 0 Previous Next

  • All Statement Test Example

    < Back All Statement Test Example This is an example program showing how to use all statements. Program --- all Statement Test Program no 1 This is an example program showing how to use all statements. --- prog_vars = d/pin1 0 d/pin2 1 d/pin_no 0 d/text1 "Jack" d/text2 "Jill" prog_vars. prog_start = print " -------------- " print "all statement test program" prog_start. prog_loop = -- Test 1 Should be TRUE ie /pin_no != 1 /pin1 0 /pin2 1 /pin_no 2 all /pin_no != 1 -> print "Test 1 TRUE CORRECT" else print "Test 1 FALSE WRONG" exitprog enda. -- Test 2 Should be FALSE ie /text1 not = to /text2 all /text1 = /text2 -> print "Test 2 TRUE WRONG" else print "Test 2 FALSE CORRECT" exitprog enda. -- Test 3 Should be TRUE ie /text1 is != /text2 all /text1 != /text2 -> print "Test 3 TRUE CORRECT" else print "Test 3 FALSE WRONG" exitprog enda. -- Test 4 Should be TRUE ie /text1 is "JacK" all /text1 = "Jack" -> print "Test 4 TRUE CORRECT" else print "Test 3 FALSE WRONG" exitprog enda. prog_loop. prog_stop = print "Bye" prog_stop.

  • Ant Command Test

    < Back Ant Command Test This is a test for the ant command. Program --- Ant test Program --- prog_vars = d/count 0 prog_vars. prog_start = rdbg 5 /count 1 prog_start. prog_loop = test_ant 10 10 test_ant 1000 1000 exitprog prog_loop. test_ant /in_count 0 /int1 0 = print "Ant Test count /in_count " ant /in_count -> < -10 -> print "Count is < -10"|tg d1 /int1 < 0 -> print "Count is < 0"|tg d1 < 10 -> print "Count is < 10"|tg d1 < 100 -> print "Count is < 100 ERROR"|tg d1 < 200 -> print "JP99"|task1 /count -> print "Default Action" ant. print "POST the ant" test_ant. prog_stop = print "Bye" prog_stop.

  • USER LED Commands

    < Back USER LED Commands suled Control a User LED suled Control a USER LED Purpose Control the color and brightness of one of the USER LEDs on the JackBord Syntax This command has two versions: Syntax 1: In this version you use a single number between 0 and 15 to set the color of the specified USER LED, using the colors in the table below. suled L C U Arguments L The number of the USER LED to be controlled. LED no USER LED 1 Front (block 2 & 3) 2 Internal USER LED 2 (block 3) 3 Internal USER LED 3 (block 3) C The color to set the LED to, from the list of colors below: Examples suled 1 3 This sets USER LED to the colour red. Syntax 2: Use RGB values to set the LEDs color sled L R G B Arguments L The number of the USER LED to be controlled. LED no USER LED 1 Front (block 2 & 3) 2 Internal USER LED 2 (block 3) 3 Internal USER LED 3 (block 3) R The red value, 0 to 255 G The green value, 0 to 255 B The blue value, 0 to 255 Examples suled 3 255 255 255 Set USER LED 3 to white suled 1 128 0 0 Set the front USER LED to red Notes This command is for the USER LEDs. The USER LEDs can also be controlled on port l. Where l1 is the front USER LED, so l1 1 turns the front USER LED on. l1 15 sets the front USER LED to be purple and so on.

  • TOP Smart RGB LED Demo 2

    < Back TOP Smart RGB LED Demo 2 This program uses the TOPs RGB LED to slowly display red, green and blue colors one after the other. Program --- TOP Smart RGB LED Demo 2 This program uses the TOP's RGB LED to slowly display red, green and blue colors one after the other. --- prog_vars = d/count 0 d/led_red 0 d/led_green 0 d/led_blue 0 prog_vars. prog_start = pclear sledn 1 print "Smart RGB Demo 2: Start" prog_start. prog_loop = -- main program loop -- red repeat 255 -> -- display the color sled 1 /led_red /led_green /led_blue inc /led_red 1 repeat. /led_red 0 -- green repeat 255 -> -- display the color sled 1 /led_red /led_green /led_blue inc /led_green 1 repeat. /led_green 0 -- blue repeat 255 -> -- display the color sled 1 /led_red /led_green /led_blue inc /led_blue 1 repeat. exitprog prog_loop. prog_stop = print "Bye" sledoff prog_stop.

  • Actuator Commands

    < Back Actuator Commands calstr - Run the steering limit switch calibration routine Purpose This routine is for robots using a linear actuator steering system with left, center and right steering limit switches fitted. The routine establishes the range of the steering actuator and the location of the centre limit switch in terms of pulses applied to the linear actuator. It also determines the travel length of the actuator in terms of the number of pulses required to move it through it’s full range. Syntax calstr Notes This is for robots with a linear actuator steering system. Once the calibration has been successfully completed the steering system will automatically use the new values so that the various built in steering functions will work as expected. mvsa - Move linear steering actuator Purpose Moves the steering actuator into a new position. Syntax mvsa pos Arguments pos The new position measured in pulses required to reach that position. Examples mvsa 0 mvsa 100 Notes The required pulses need to be determined by running the calstr command first. vdl - Drive System Limit Switch Status Purpose Display the current Drive System Limit Switch Status Syntax vdl Example > vdl < LAct Steering: Limits Regs L0C0R0 HW State Cal L 0 C 0 R 0 C 0 R 0 POS 0

  • Simple WiFi Signal

    < Back Simple WiFi Signal This program will display the Wifi signal strength received by the JackBord. it will do 100 runs and then stop. It uses the /s_wifisig system variable to get the Wifi signal strength. Program --- Simple Wifi Signal Program This program will display the Wifi signal strength received by the JackBord. it will do 100 runs and then stop. It uses the /s_wifisig system variable to get the Wifi signal strength. --- prog_vars = d/run_no 0 prog_vars. prog_start = "Wifi Signal Program" prog_start. prog_loop = -- Display the Wifi Signal Strength "Run /run_no Wifi signal /s_wifisig" -- Exit after 100 runs inc /run_no any /run_no >= 100 -> "Run /run_no Time to Exit" exitprog enda. prog_loop. prog_stop = print "Prog STOPPED!" prog_stop.

  • Any Statement Example

    < Back Any Statement Example In this example we check the value of /count against 10 and quit when /count is 10. Program -- Any example no 1 prog_vars = d/count 0 prog_vars. prog_start = print "Any example no 1" prog_start. prog_loop = inc /count print "Count /count" any /count >= 10 -> exitprog prog_loop. prog_stop = print "Bye" prog_stop.

  • General Commands

    < Back General Commands hi Command hi Display a simple hello message bye Command bye Log off the JackBord. For multi user systems only. vs View Status Command vs Display the status of the JackBord Purpose Displays status information for the JackBord including the up time and the running program, etc. Syntax vs inc Increment a Value inc Increment a value Purpose This command will increment the value of the specified port or variable by one. Or, if an offset is provided by that offset. Syntax inc target offset Arguments target This is the desired port pin ie a1, c4, etc. A channel number or variable. offset The amount by which the value of the target is to be incremented. If this is omitted, a value of 1 will be used by default. Pushers Yes Examples inc a1 Increment the value of port A1 by 1 inc a1 5 Increment the value of port A1 by 5 inc /count Increment the value of the /count variable by 1 inc /count 100 Increment the value of the /count variable by 100 inc /beans ->bean_count dec Decrement a Value dec Decrement a value Purpose This command will decrement the value of the specified port or variable by 1. Or if an offset is provided by that offset. Syntax dec target offset Arguments target This is the desired port pin ie a1, c4 etc. A channel number or a variable. offset The amount by which the value of the target is to be decremented. If this is omitted a value of 1 will be used by default. Pushers Yes Examples dec a1 Decrement the value of port a1 by 1. dec a1 5 Decrement the value of port a1 by 5. dec /count Decrement the value of the /count variable by 1 dec /count 100 Decrement the value of the /count variable by 100 dec /beans -> /bean_count

bottom of page