Search Results
285 results found with an empty search
- Short Range Proximity Sensor
< Back Short Range Proximity Sensor This program displays the analog output from the sensor as a bar gauge. The sensors analog output goes to pin a1. The analog output of the sensor is scaled between 0 and 100 by the gvr command. Program --- Short Range Proximity Sensor Program This program disoplays the analog output from the sensor as a bar gauge. The sensors analog outpout goes to pin a1. tmt3Nndt --- prog_vars = d/line_length 0 prog_vars. prog_start = pclear print "Program Start" -- Setup the pin as an analog input. gvr a1 0 100 ptl 10 10 ^ts=24^ "Distance" -- Add the quit button pb 150 20 ^n=Quit^p=exitprog^ prog_start. prog_loop = -- main program loop -- Invert the line so it goes up as the value does. sub -1 /a1 -> /line_length -- Plot the sensor value pvl 50 175 /line_length ^lw=10^ -- Display the value ptl 45 175 ^id=dis^ts=24^ "/a1" -- Short delay d250 prog_loop. prog_stop = ptl 10 10 ^ts=24^ "Bye" prog_stop.
- TOP Smart RGB LED Demo 1
< Back TOP Smart RGB LED Demo 1 This program displays the standard colors on the TOPs smart RGB LED starting at 0 and ending at 15. This demo is part of the video "Using the TOPs Smart EGB LED". Program --- TOP Smart RGB LED Demo 1 This program displays the standard colors on the TOPs smart RGB LED starting at 0 and ending at 15. This demo is part of the video "Using the TOPs Smart EGB LED". --- prog_vars = d/led_color 0 prog_vars. prog_start = pclear sledn 1 print "Smart RGB Demo 1: Start" prog_start. prog_loop = -- main program loop -- display the color sled 1 /led_color -- Wait a quarter of a second. d250 -- Increment /led_color to the next color inc /led_color -- Check if we are done any /led_color > 15 -> exitprog prog_loop. prog_stop = print "Bye" prog_stop.
- Rocket Launch
< Back Rocket Launch This program displays some information during a rocket launch. Program --- First Octagon Progam Refer to section 5.2 of the JackBord JOurneys book no 1 while looking at this program. --- prog_vars = d/launch_rocket 0 d/air_temperature 0.0 d/rh 0 d/address "" prog_vars. prog_start = -- Setup the pgoram /launch_rocket 10 /air_temperature 28.5 /rh 80 /address "1 Olympus Mons Mars" prog_start. prog_loop = -- Display some information print "Launch in /launch_rocket secs" print "to /address" print "where the air temp is /air_temperature RH is /rh" exitprog prog_loop. prog_stop = print "Prog STOPPED!" prog_stop.
- Basic 90-Degree Turn
< Back Basic 90-Degree Turn This program should see the robot be able to turn 90 degrees to the left and 90 degrees to the right. Program --- Basic 90 degrees Turn Program This program should see the robot be able to turn 90 degrees to the left and 90 degrees to the right. --- prog_vars = d/count 0 prog_vars. prog_start = pclear print "Basic Drive Program Start" stop prog_start. prog_loop = left_turn_90deg -- right_turn_90deg exitnow prog_loop. left_turn_90deg = -- The robot should turn 90 degrees to the left. -- Adjust the delay value in the dly command to -- make the robot turn to the left by 90 degrees. stop rms 50 dly 250 -- change this delay to make the turn work stop left_turn_90deg. right_turn_90deg = -- The robot should turn 90 degrees to the right -- adjust the delay value in the dly command to -- make the robot turn to the right by 90 degrees. stop lms 50 dly 250 -- change this delay to make the turn work stop right_turn_90deg. prog_stop = print "Bye" prog_stop.
- RGB Light Mixer
< Back RGB Light Mixer Light Mixer Program Uses an RGB LED on Port C and two variable resistors on pin B1 and B2. B1 controls the RED LED on C1. B2 controls the RED LED on C2. Program --- Light Mixer Program Uses an RGB LED on Port C and two variable resistors on pin B1 and B2. B1 controls the RED LED on C1. B2 controls the RED LED on C2. --- prog_vars = d/a 0 prog_vars. prog_start = -- Setup the RED LED control, B1 gvr b1 0 100 c1 pwm c1 50 -- Setup the GREEN LED control, B2 gvr b2 0 100 c2 pwm c2 50 prog_start. prog_loop = exitnow prog_loop. prog_stop = "Good bye" prog_stop.
- RGB Color Sensor Demo 2
< Back RGB Color Sensor Demo 2 This program is for the RGB color sensor, and plots the clear, red, green and blue color values as vertical bars on the show page. Program --- RGB Color Sensor Demo 2 --- prog_vars = d/red_line 0 d/green_line 0 d/blue_line 0 d/clear_line 0 prog_vars. prog_start = pclear d1000 ptl 10 5 ^ts=24^ "RGB Color Sensor Demo Program" -- Enable the I2c system i2con -- Display the Quit button pb 400 20 ^n=Quit^p=exitnow^ prog_start. prog_loop = -- main program loop -- Invert the values so the bars go up sub -1 /cs_clear -> /clear_line sub -1 /cs_red -> /red_line sub -1 /cs_green -> /green_line sub -1 /cs_blue -> /blue_line -- Display the colors as vertical bars pvl 25 300 /clear_line ^lc=yellow^lw=20^ pvl 75 300 /red_line ^lc=red^lw=20^ pvl 125 300 /green_line ^lc=green^lw=20^ pvl 175 300 /blue_line ^lc=blue^lw=20^ -- Display the values ptl 15 300 ^ts=16^ "/cs_clear" ptl 65 300 ^ts=16^ "/cs_red" ptl 115 300 ^ts=16^ "/cs_green" ptl 165 300 ^ts=16^ "/cs_blue" -- Set the USER 1 LED to the color. l1 /cs_red /cs_green /cs_blue prog_loop. prog_stop = ptl 100 200 ^ts=75^ "Bye" prog_stop.
- Basic Capacitive Soil Moisture Sensor
< Back Basic Capacitive Soil Moisture Sensor This program works with the capacitive soil moisture sensor probe and scales the readings from the sensor so you get soil moisture readings from 0% (dry) to 100% (soaked). Program --- Basic Capacitive Soil Moisture Sensor Program Get readings from the sensor on pin a1 and scale them between the min and max calibration values to get a reading between 0 and 100. --- prog_vars = d/count 0 -- Calibration values d/min_value 6 d/max_value 56 -- The final soil moisture reading d/soil_moisture 0 prog_vars. prog_start = pclear print "Program Start" -- Setup the sensor on pin a1 gvr a1 100 0 prog_start. prog_loop = -- main program loop get_soil_moisture print "Count /count Soil moisture /soil_moisture" inc /count any /count >= 10 -> exitprog -- Wait 1 sec between readings d1000 prog_loop. get_soil_moisture = -- Get the reading from a1 and scale it mapi /min_value /max_value 0 100 /a1 -> /soil_moisture get_soil_moisture. prog_stop = print "Bye" prog_stop.
- Smart LED Commands
< Back Smart LED Commands sled Smart LED Control sled Control WS2812B smart LEDs Purpose Control the color and brightness of one or more WS2812B Smart LEDs attached to port C5 on their JackBord. Note: you need to run the sledn command first to tell the JackBord how many LEDs are connected to the strip. So if we had 10 LEDs the command would be sledn 10 and so on. In this example the first led in the strip is number 1, the last is no 10. 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 LED, using the colors in the table below. sled N C U Arguments N The number of the LED to be controlled. C The color to set the LED to, from the list of colors below: U Update the LEDs: Missing means update the LEDs now. 0 = Don't update them, instead use the usled command later to update them all in one go. Examples sled 5 3 The 3 is the color red. If you ran the command with a 0 at the end the LEDs wont change until you run the usled command which updates them all. eg sled 5 3 0 Syntax 2: Use RGB values to set the LEDs color. sled N R G B U Arguments N The number of the LED to be controlled. R The red value, 0 to 255 G The green value, 0 to 255 B The blue value, 0 to 255 Pushers No U Update the LEDs: Missing means update the LEDs now. 0 = Don't update them, instead use the usled command later to update them all in one go. Examples sled 3 255 255 255 Set LED 3 to white and do it right now sled 3 255 255 255 0 Set LED 3 to white but don't update the LED, LED will only change color when the usled command is run. Notes Works with a WS2812B smart led strip. Use the usled command to update the LEDs all in one go. sledb Set Smart LED Brightness sledb Set the brightness of the smart LEDs. Purpose Set the brightness of the WS2812B Smart LEDs attached to port C5 on ther JackBord. Note: you need to run the sledn command first to tell the JackBord how many LEDs are connected to the strip. So if we had 10 LEDs the command would be sledn 10 and so on. Syntax sledb B Arguments B The desired brightness from 0 to 100. 0 = Off 100 = Maximum brightness. Examples sledb 0 Turn the smart LEDs off sledb 50 Set the brightness to half Notes Works with a WS2812B smart led strip. sledn Set Number of Smart LEDs sledn Set the number of Smart LEDs connected to the JackBord. Purpose Tells the JackBord how many WS2812B smart LEDs it is controlling with the sled command. NOTE: You need to run this command BEFORE using the sled command. Syntax sledn total Arguments total The total number of WS2812B smart LEDs connected to the JackBord.1 to 50. Examples sledn 10 Notes Works with a WS2812B smart led strip. sledoff Turn All of the Smart LEDs Off sledoff Turn all of the smart LEDS off Purpose Turn all of the WS2812B Smart LEDs off on a given pin. Syntax sledoff #~ Arguments # The port letter a, b, c, d ~ The port pin number 1 to 5 Notes Works with a WS2812B smart led strip.
- Task Arguments Test
< Back Task Arguments Test This is a test program for task arguments. Program --- Task Arguments Test Program --- prog_vars = d/count 0 d/begin_count 255 d/message "" prog_vars. prog_start = print "Prog Start" /count 0 /message "Fred and Dag" rdbg 7 lv prog_start. prog_loop = inc /count print "Run /count" -- Channel input @TEST -- print "Call Test Task2 Channel in" -- test_task2 /240 "Jack and Jill" -- Test task 1 print "" print "Call Test Task1 no in or out" test_task1 -- Test task 2 print "" print "Call Test Task2 in only" test_task2 123564 "Jack" print "FRED_DAG" test_task2 888 /message lv test_task5 123 123.456 print "Call Test Task2 in only RUN 2" test_task2 88 "Jack and Jill" print "Call Test Task2 in only RUN 3" test_task2 /count "Jack and Jill" -- System Varibale input print "Call Math Task1 Sys var in" maths_task1 /pi -- Test task 3 print "" print "Call Test Task3 out only" d/out1 0 d/out2 "" test_task3 -> /out1 /out2 print "" print "Task3 out1 [ /out1 ] out2 [ /out2 ]" print "Task3 direct o1 [ /output1 ] o2 [ /output2 ]" -- Test task 4 print "" print "Call Test Task4 in & out" /out1 0 /out2 "" test_task4 100 "Jack Penman" -> /out1 /out2 print "Task4 o1 [ /out1 ] o2 [ /out2 ]" print "Task4 direct o1 [ /output41 ] o2 [ /output42 ]" --- Deliberate Error Cases The following are dekoverately wrong. -- extra input arg. maths_task1 /pi "Jack and Jill" --- -- inc /count -- any /count > 10 -> exitprog exitprog prog_loop. test_task1 = -- task with no inputs or outputs print "test_task1 no in or out" test_task1. test_task2 /input1 1 /input2 "" = -- task with inputs only. print "test_task2 in1 /input1 in2 /input2" test_task2. test_task3 -> /output1 1 /output2 "" = -- task with outputs only. -- Set the output values. /output1 100 /output2 "Output no 2" print "test_task3 out1 [ /output1 ] out2 [ /output2 ]" test_task3. test_task4 /input41 1 /input42 "" -> /output41 1 /output42 "" = -- task with inputs and outputs. -- Set the output values. /output41 100 /output42 "Output no 2" print "test_task4 in1 [ /input41 ] in2 [ /input42 ]" print "test_task4 out1 [ /output41 ] out2 [ /output42 ]" test_task4. test_task5 /in51 0 /in52 0.0 = -- task with two numeric inputs. print "Task5 Integer input [ /in51 ] float in [ /in52 ]" test_task5. maths_task1 /mathin1 0.0 = print "Maths Task 1 input /mathin1" maths_task1. prog_stop = print "bye" prog_stop.
- Romeos Infrared Remote Control Driving Program
< Back Romeos Infrared Remote Control Driving Program This program allows a JackBord to with drive motors to be driven using a normal TV remote control. Program --- Romeos Infrared Remote Control Driving Program 22 July 2021 This program allows a JackBord with drive motors to be driven using a normal TV remote control. --- prog_vars = d/count 0 d/color 0 d/pos 50 d/neg -50 prog_vars. prog_start = pclear stop -- Claw up and open svp c1 0 svp c2 180 print "Program Start neg /neg pos /pos" prog_start. prog_loop = -- pclear -- "/s_ird neg /neg pos /pos" -- Motion Control any /s_ird = 505 -> sbms /pos /pos any /s_ird = 481 -> sbms /pos /neg any /s_ird = 515 -> sbms /neg /neg any /s_ird = 527 -> sbms /neg /pos any /s_ird = 542 -> sbms 0 0 -- Claw control any /s_ird = 513 -> svp c1 0 any /s_ird = 541 -> svp c1 50 any /s_ird = 511 -> svp c2 0 any /s_ird = 418 -> svp c2 180 -- Speed Control any /s_ird = 517 -> /pos 40|/neg -40 any /s_ird = 519 -> /pos 60|/neg -60 inc /count any /count >= 5 -> rand 1 15 -> /color l1 /color rand 1 15 -> /color l2 /color rand 1 15 -> /color l3 /color /count 0 enda. prog_loop. prog_stop = bms 0 print "Bye" prog_stop.
- Auto Booting/Running a Program
< Back Auto Booting/Running a Program The setboot command is used to set one of the programs on the JackBord to run when the JackBord is turned on. Program Setting a Program to Run at Boot The command format is: setboot prog_number Where prog_number is the number of the program we wish to run at boot, ranging from 1 to 10. To set program number 5 to run at boot type: setboot 5 The next time the JackBord starts it will run program number 5. You can check which program is set to auto run using the vp program status command. Once you have set the boot program you can test it using the reboot command to re-start the JackBord, if all is well the selected program should run. Clearing a Set Boot Program Use the setboot command with program number 0 eg: setboot 0 This will stop the currently running boot program and clear it so no program will run automatically on the next boot. Running the Boot Program Just Once To run the boot program just once, ie because it just needs to configure the robot, you should place an exitprog command at the bottom of the prog_loop task. That way the program_loop will only run once and the program will exit. Notes: You cant run other programs while the boot program is running, this is because the JackBord can only run one program at a time. You can use the command line and most of the commands while the boot program is running.
- Projects - WiFi Signal Dial
< Back WiFi Signal Dial In this project, we are going to turn the JackBord into a dial so we can visually see the strength of the WiFi signal it is currently receiving. We will use an RC servo, which will move its arm in response to the WiFi strength. First, we learn how the JackBord measures WiFi strength, and then we learn how to attach a RC servo to the JackBord. We then create our own dial and attach it to the JackBord and the RC servo. Finally, we put it all together by running a program that controls the servo’s arm based on the strength of the WiFi. PDF INSTRUCTIONS Project Gallery
- Weather Station
< Back Weather Station Program --- Wind vane A1 Anno A5 Rain B2 --- prog_vars = d/count 0 d/air_temp 0.0 d/rh 0 d/press 0.0 d/light 0 d/wind_speed 0.0 d/wind_dir 0 d/at_arc 0 d/display_update_timer 0 prog_vars. prog_start = pclear ptl 10 0 ^ts=35^ "Live Weather" i2con sctp a5 gvr a1 360 0 sctp b2 scgoff 38 1 574.0 -- Create a new Dataset for the Data newds "met 12 Oct 2021" -- Set the chans to include dslc 1 dslc 5 dslc 7 dslc 35 dslc 36 dslc 37 dslc 38 -- Set the log interval to 5mins slog 300 -- Start logging lgon setuct 1 25 setuct 2 5 -- Set the light update thresh to 500 setuct 35 500 -- Quit button pb 700 10 ^n=Quit^p=exitprog^ "Setup Done" prog_start. prog_loop = -- main program loop any /display_update_timer > 100 -> update_display "/display_update_timer" /display_update_timer 0 else inc /display_update_timer enda. prog_loop. update_display = -- Display the readings -- Air temp round /36 2 -> /air_temp pg 10 125 /air_temp ^id=airt^ts=24^tc=red^w=200^n=Air T^min=-10^max=40^ ptl 40 220 ^ts=20^tc=red^ "Air T /air_temp" -- RH /rh /37 pvl 250 150 /rh ^id=rh^lw=10^lc=blue^ ptl 240 220 ^id=rht^ts=20^tc=blue^ "RH /rh" -- Light mapi 0 50000 0 200 /35 -> /light sub 200 /light -> /light pvl 440 150 /light ^id=srad^lw=10^lc=yellow^ ptl 440 220 ^ts=20^tc=yellow^ "Light /light /35" -- Wind Direction sub 360 /a1 -> /wind_dir pal 150 420 80 /wind_dir ^lw=10^lc=cyan^ ptl 150 500 ^ts=20^tc=cyan^ "Dir /wind_dir" update_display. prog_stop = print "Bye" prog_stop.
- Bumper Robot
< Back Bumper Robot This program is for the bumper robot. It has a front bumper connected to port A pin A1 and a back bumper connected to port A pin A2. When the robot collides with an object on the front bumper, it will first of all go backwards and secondly it will do a slight turn so as to avoid the object in the future. Likewise when it hits an object in the rear it will move forwards and do a slight turn. Program --- Bumper Robot Program This program is for the bumper robot. It has a front bumper connected to port A pin A1 and a back bumper connected to port A pin A2. --- prog_vars = -- Keep track of the number of bumps. d/front 0 d/back 0 -- Track to no of times we have run. d/count 0 prog_vars. prog_start = print "Bumper Robot Program Setup" -- Reset the buttons rstb -- Setup the front bumper. -- Go back and turn left. btp a1 bms -50|lms -10|d500|lms -50|inc /front -- Setup the back bumper. -- Go forward and turn right. btp a2 bms 50|rms 10|d500|rms 50|inc /back -- Set both motors to forwards at 50 bms 50 prog_start. prog_loop = -- main program loop -- Increase the /count by 1 inc /count -- Check if we shoukd exit. any /count > 1000 -> exitprog prog_loop. prog_stop = print "Bye Front /front Back /back" -- Clear the buttons rstb -- Stop the robot stop prog_stop.
- Quake Indicator
< Back Quake Indicator This has 3 RC Servos connected to ports A1 to A3. Program --- Quake Indicator Program This has 3 rc servos connected to ports A1 to A3. --- prog_vars = d/count 0 prog_vars. prog_start = pclear print "Program Start count /count" prog_start. prog_loop = -- main program loop print "Count /count" inc /count any /count >= 50 -> exitprog small_quake medium_quake big_quake exitnow prog_loop. small_quake = "small" -- Sweep Servo on A1 svs a1 90 5 small_quake. medium_quake = "Medium" -- Sweep Servo on A2 svs a2 90 5 medium_quake. big_quake = "Big" -- Sweep Servo on A3 svs a3 90 5 big_quake. prog_stop = print "Bye" prog_stop.
- Projects - Automatic Night Light
< Back Automatic Night Light In this project, you will make use of the LDR sensor on the TOP to create a light-sensitive night light with one of the LEDs. This will be done by creating a potential divider circuit on the TOP to obtain a light-dependent voltage reading. This reading will then be used to control the brightness of an LED so that when it gets darker, the LED becomes brighter. PDF INSTRUCTIONS Project Gallery
- Default New Octagon Program
< Back Default New Octagon Program This is a default new Octagon program template. Use it to create a new program. Program --- New Octagon Program --- prog_vars = d/count 0 prog_vars. prog_start = print "Program Start" prog_start. prog_loop = -- main program loop print "Count /count" inc /count any /count >= 10 -> exitprog prog_loop. prog_stop = print "Bye" prog_stop.
- Sync Command Test
< Back Sync Command Test This is a program to test the new sync command. Program --- Sync Command Test Program This is a program to test the new sync command. --- prog_vars = d/var1 1 d/var2 2 d/volts 0 d/volt2 0 d/speed 0 d/light 0 d/run_no 0 d/turn_servo 0 d/sine 0.0 prog_vars. prog_start = print "Sync Test Prog" -- Sync var 2 to var 1's value. sync /var1 /var2 -- get port B1 gvr b1 -50 180 -- Setup a Sync Daisy Chain -- Sync b1 to /volts var sync b1 /volts -- get port B2 . Steering gvr b2 -100 100 sync b2 /light sync b2 153 free.5 mapi -100 100 0 180 /light -> /turn_servo sync turn_servo c1 free.1 -- Motor speed control sync /volts 150 sync 150 /speed svp c1 /speed sync b1 c1 sync /speed 150 free.5 pwm d1 50 sync b1 d1 pwm a1 50 sync /light a1 pwm a2 50 sync /light a2 sync /light d1 free.5 pwm a3 50 sync /b1 a3 pwm a4 50 sync /b1 a4 src free.1 svp c1 50 "******* RUN PROG **********" prog_start. prog_loop = -- Update var 1 /var1 /run_no sin /run_no -> /sine mapf -1 1 0 100 /sine -> /sine -- "var1 /var1 syncs to var2 /var2" -- "b1 /b1 volts /volts 150 /150" -- "light /light turn /turn_servo" tbar * /sine 50 10 "s /sine" -- svp c1 /speed -- poowm d1 /speed inc /run_no any /run_no > 1000 -> exitprog prog_loop. prog_stop = print "bye" prog_stop.
- Bumper Robot V2
< Back Bumper Robot V2 This version of the bumper robot has a smart RGB LED strip fitted with 5 LEDs. There is a front and back bumper connected to pins a1 and a2 respectively. If the front bumper is triggered the robot will move backwards and the LEDs will start to flash from the front to the back indicating that the robot is moving backwards. If the back bumper is triggered the robot will start to move forward and the LEDs will flash from the back to the front to indicate the change in direction. Program --- Bumper Robot Program V2 --- prog_vars = -- Keep track of the number of bumps. d/front 0 d/back 0 -- Track to no of times we have run. d/count 0 d/speed 0 -- Direction timer d/dir_timer 0 d/dir 0 d/total_leds 5 d/led_no 0 d/red 0 d/green 0 d/blue 0 prog_vars. prog_start = print "Bumper Robot Program Setup" -- Reset the buttons rstb -- Setup the front bumper. -- Go back and turn left. btp c1 front_bump btp c2 back_bump bms 50 sledn 10 sledoff prog_start. prog_loop = -- main program loop -- Increase the /count by 1 inc /count /speed /150 -- Change dirtection if it gets stuck. any /dir_timer > 400 -> /dir_timer 0 tgdir enda. -- Set each color to a random value -- rand 0 255 -> /red -- rand 0 0 -> /green -- rand 0 255 -> /blue all /dir = 0 /led_no < 7 -> inc /led_no all /dir = 0 /led_no >= 7 -> /led_no 0 all /dir = 1 /led_no >= 1 -> dec /led_no all /dir = 1 /led_no <= 0 -> /led_no 7 -- "dir /dir /led_no" sled /led_no /red /green /blue prog_loop. front_bump = -- Task for front bumper -- Set each color to a random value rand 0 0 -> /red rand 0 255 -> /green rand 0 0 -> /blue bms -50 lms -10 d500 lms -50 inc /front /dir_timer 0 /dir 1 front_bump. back_bump = -- Task for the back bumper rand 0 255 -> /red rand 0 0 -> /green rand 0 0 -> /blue bms 50 rms 10 d500 rms 50 inc /back /dir_timer 0 /dir 0 back_bump. prog_stop = print "Bye Front /front Back /back" -- Clear the buttons rstb -- Stop the robot stop prog_stop.
- Twinkle Star
< Back Twinkle Star Make the USER LED twinkle like a star. This program uses the rand command to generate a random color which is then used to set the color of the USER LED on the front of the JackBord. Program --- Twinkle Star Program Make the USER LED twinkle like a star. --- prog_vars = d/color 0 prog_vars. prog_start = print "Twinkle Star Program." prog_start. prog_loop = -- Get a new random color rand 0 15 -> /color -- Set USER LED to the color l1 /color prog_loop. prog_stop = print "Exit Twinkle" prog_stop.
