top of page

Search Results

285 results found with an empty search

  • USER LED Colour Control

    < Back USER LED Colour Control This program controls the color of the USER LED using a variable resistor. Turning the knob will change the color of the USER LED. In this version the variable resistor POT1 on the JackBord TOP is connected to port pin B1 on a block 2 JackBord. For a block 3 JackBord use port Pin A1. Program --- Control the Color of the USER LED using a variable resistor. Turning the knob will change the color of the USER LED. --- prog_vars = d/count 0 prog_vars. prog_start = pclear print "Program Start" gvr b1 0 15 l1 prog_start. prog_loop = -- main program loop print "Count /count" inc /count any /count >= 1000 -> exitprog prog_loop. prog_stop = print "Bye" prog_stop.

  • sled Example 8 LED Program

    < Back sled Example 8 LED Program This program works with a strip of 8 smart RGB leds connected to the SLED pin on port E (pin E1 in some models.) It randomly chnages the color of each LED. Program --- sled Example Light Program This program works with a strip of 8 smart RGB leds connected to the SLED pin on port E (pin E1 in some models.) It randomly chnages the color of each LED. --- prog_vars = d/count 0 d/led_no 1 d/color 0 d/no_of_leds 8 prog_vars. prog_start = print "Program Start" -- Set the number of LEDS sledn /no_of_leds prog_start. prog_loop = -- main program loop print "Count /count" inc /count any /count >= 1000 -> exitprog -- Set a random color rand 0 15 -> /color -- Set the led sled /led_no /color inc /led_no -- Return to first led. any /led_no > 8 -> /led_no 1 prog_loop. prog_stop = print "Bye" prog_stop.

  • JackBord Mars Rover Demo

    < Back JackBord Mars Rover Demo ​ Program --- Mars Rover Program --- prog_vars = d/apr_dist 50 prog_vars. prog_start = pclear print "Program Start" i2con -- Setup the Radar uradar c1 c2 -- Forward pb 125 60 ^p=bms 50|d250|stop^n=Fwd 2^ pb 125 95 ^p=bms 50|d500|stop^n=Fwd 5^ -- Back pb 200 60 ^p=bms -50|d250|stop^n=Rev 2^ pb 200 95 ^p=bms -50|d500|stop^n=Rev 5^ -- Speed slider psl 65 120 200 ^id=150^var=150^min=-100^max=100^ "/150" -- Turns -- LEFT pb 35 60 ^p=sbms -65 65|d100|stop^n=L 10^ pb 35 95 ^p=sbms -65 65|d500|stop^n=L 90^ -- RIGHT pb 300 60 ^p=sbms 65 -65|d100|stop^n=R 10^ pb 300 95 ^p=sbms 65 -65|d500|stop^n=R 90^ -- Claw pb 250 155 ^p=svp a1 90^n=O^ pb 300 155 ^p=svp a1 180^n=C^ -- Approach pb 50 250 ^p=approach^n=Approach^ -- STOP pb 350 20 ^p=stop^n=STOP^fc=red^ -- Approach Slider psl 50 275 200 ^id=apr^var=apr_dist^min=0^max=100^ "/apr_dist" prog_start. prog_loop = -- main program loop d100 ptl 10 0 ^tf=courier^ts=25^ "Radar /35" prog_loop. approach = -- Get 25cm from an object with radar. ptl 10 300 ^id=arvb^tc=black^ "apr /apr_dist cm" bms 50 repeat 5000 -> d100 ptl 10 0 "Radar /35" any /35 <= /apr_dist -> stop ptl 10 300 ^id=arvb^tc=red^ "Arrived /35" skipout enda. repeat. "Ext Approach" approach. prog_stop = print "Bye" stop prog_stop.

  • Simple WiFi Signal Dial with an RC Servo

    < Back Simple WiFi Signal Dial with an RC Servo This is the program for the Simple Wifi Signal Dial with an RC Servo, which is used in it's respective project as well as activity 4001-act11. This is what makes the WiFi signal control the servo arm Program --- Simple Wifi Signal Metre with an RC Servo 4001-act11 --- prog_vars = d/run_no 0 d/arm_angle 0 prog_vars. prog_start = pclear "4001-act11 Simple Wifi Signal Metre with an RC Servo Program" svp a1 0 prog_start. prog_loop = -- Calc the arm angle. mapi -90 -30 0 180 /s_wifisig -> /arm_angle -- Set the servos arm svp a1 /arm_angle -- Display the Wifi Signal Strength "Run /run_no Wifi signal /s_wifisig Arm /arm_angle" inc /run_no prog_loop. prog_stop = print "Bye" svp a1 0 prog_stop.

  • Variables Example

    < Back Variables Example Create and use some variables in Octagon. Do some maths on some variables and display the results. The result of the program running should be: Done exiting now! Result of subtracting is : 10 100 1.50 is -91.50 Result of adding 10 100 -3.14 is 106.86 Variables Example Program no 1 Program --- Variables Program Example Create and use some variables in Octagon --- prog_vars = d/a 10 -- integer var set to 10 d/b 100 -- integer var set to 100 d/c -3.141 -- float var set to -3.141 d/total 0.0 -- float to hold total d/message "" -- text var, empty prog_vars. prog_start = /total 0.0 -- reset /total to 0.0 prog_start. prog_loop = print "Variables Example Program no 1" -- Add some numbers , store result in /total add /a /b /c -> /total -- Set a message to show /message "Result of adding " -- Show the result print "/message /a /b /c is /total" -- Set new value of /c /c 1.5 -- Subtract some numbers , store result in /total sub /a /b /c -> /total -- Update the /message /message "Result of subtracting is : " -- Show the result print "/message /a /b /c is /total" print "Done exiting now!" exitprog prog_loop. prog_stop = exitprog prog_stop.

  • Smart Night Light

    < Back Smart Night Light This uses the JackBord block 3s internal USER LEDs to create a smart night light. A button attached to pin A1 is used to set the mode of operation of the light. Mode 1 produces warmer colors because it uses more red light. Mode 2 results in more daylight color because it uses more blue and green light. Program --- Smart Night Light Program This uses the JackBord block 3's internal USER LEDs to create a smart night light. A button attached to pin A1 is used to set the mode of operation of the light. --- prog_vars = d/led_no 0 d/red 0 d/green 0 d/blue 0 d/mode 1 prog_vars. prog_start = pclear print "Smart Night Light Program Started" -- turn all USER leds off loff -- Setup the button on A1 to set the mode btp a1 set_mode prog_start. prog_loop = "mode /mode" -- Determien the mode we should be in ant /mode -> = 1 -> mode1 = 2 -> mode2 -> mode1 ant. -- Set the color of the USER LEDs l1 /red /green /blue l2 /red /green /blue l3 /red /green /blue -- Wait a while dly 1000 prog_loop. set_mode = -- called by the button press. -- If we are in mode 1 goto mode 2. ant /mode -> = 1 -> /mode 2 = 2 -> /mode 1 -> /mode 1 ant. print "New Mode /mode" set_mode. mode1 = -- Use more Red colors by using more red in the light. -- and use less of the other colors. rand 100 255 -> /red rand 0 100 -> /green rand 0 100 -> /blue mode1. mode2 = -- Use more daylight colors by using more blue and green in the light. -- and use less red. rand 0 100 -> /red rand 100 255 -> /green rand 100 255 -> /blue mode2. prog_stop = print "prog stopped" prog_stop.

  • Raspberry Shake Raw Data Plotting and Alerting

    < Back Raspberry Shake Raw Data Plotting and Alerting ​ Program --- Raspberry Shake Raw Data Plotting and Alerting Program This program uses the grsk command to get a fresh set of readings from the Raspberry Shake and plots them. --- prog_vars = d/count 0 d/xpos 0 d/x_axis_ypos 300 -- Processed Sensor Values. -- These ahve the offsets applied. d/pro_EHZ 0 d/pro_ENE 0 d/pro_ENN 0 d/pro_ENZ 0 prog_vars. prog_start = pclear d500 ptl 10 5 ^ts=24^tc=blue^ "Raspberry Shake Raw Data Program" -- Add Quit Button pb 25 50 ^n=Quit^p=exitprog^ prog_start. prog_loop = -- main program loop inc /count -- Stop agftwer 1000 readings any /count >= 100000 -> exitprog -- Get a fresh set of readings from the shake grsk AM.R5C47 -- Apply Offsets to get Processed Values sub /rs_EHZ 16000 -> /pro_EHZ sub /rs_ENE -207461 -> /pro_ENE sub /rs_ENN -287500 -> /pro_ENN sub /rs_ENZ 3594472 -> /pro_ENZ -- Plot EHZ, ENE, ENN plot 0 75 ^id=rs^t1n=Z^t2n=E^t3n=N^xp=/xpos ^v1= /rs_EHZ ^v2= /rs_ENE ^v3= /rs_ENN ^ -- Display the plot value ptl 30 45 ^ts=16^ "X /xpos > EHZ /pro_EHZ > ENE /pro_ENE > ENN /pro_ENN > ENZ /pro_ENZ " any /pro_EHZ >= 50000 /pro_EHZ <= -50000 -> ptl 25 1 ^ts=25^tc=blue^ "Tapapa Hopukina Kia mau" else ptl 25 1 ^ts=25^tc=Lime^ "OK" enda. -- Next Xpos inc /xpos -- Wait a while for next readings d500 prog_loop. prog_stop = ptl 525 5 ^ts=100^ "Bye" prog_stop.

  • Date and Time Test

    < Back Date and Time Test This short program tests the JackBord's date and time commands. Program --- Date & Time Test Program This short program tests the JackBords date and time commands. --- prog_vars = d/count 0 prog_vars. prog_start = pclear print "Date & Time Program Start" prog_start. prog_loop = "Clock /s_clock" "Time Secs /s_tsecs" "Date time /s_dt" "Date /s_date" "Time /s_time" "Day /s_day Month /s_mon Year /s_year Month /s_month Day /s_dname" "Time Hour /s_hh : /s_mm : /s_ss" "Day of the Year /s_doy" "Week of the Year /s_woy" "Day of the Week /s_dow" "Month Name /s_month" "Day Name /s_dname" exitprog prog_loop. prog_stop = print "Bye" prog_stop.

  • OneWire Bus Commands

    < Back OneWire Bus Commands f1w - Find attached OneWire devices Purpose This will scan the OneWire bus looking for attached devices. When a new device is found it will be setup and added as a new channel. Syntax f1w Examples > f1w < Finding OneWire Devices.... < Found DS18B20 dev 1 type 40 [0x28]h Chan [26] Address [01:3C:CF] < Found DS18B20 dev 2 type 40 [0x28]h Chan [27] Address [FF:3C:A4] < Found 2 devices Channels & Vars Each of the devices found will be allocated the channels the require automatically. Their readings will appear in the gt command etc. l1w - List devices on the OneWire bus Purpose This command will list all of the devices on the OneWire bus. Syntax l1w Examples > l1w < Chan Name Addr Hex Mode Type Units Raw Value Errors < 26 Temp 01:3C:CF 1 DS1820_Temp C 21 21.81 0 < 27 Temp FF:3C:A4 1 DS1820_Temp C 22 22.19 0 rst1w - Reset the devices on the OneWire bus Purpose This command will reset all of the channels of devices on the OneWire bus. Syntax rst1w Examples rst1w OneWire Chans Reset s1woff - Disable the OneWire bus on port C pin 5 Purpose Turn off the OneWire us on port C5 and return it to it's default state. Syntax s1woff Examples s1woff s1won - Enable the OneWire bus on port C pin 5. Purpose Setup pin C5 as the OneWire bus so you can connect 1wire devices to it. Syntax s1won Examples s1won

  • Light Following Robot

    < Back Light Following Robot In this program, the JackBord robot will follow a light. This uses two LDR light sensors, each controlling the opposite motor. Program --- Light Following Robot Program Robot will follow a light. Uses two LDR light sensors, each controlling the opposite motor. --- prog_vars = d/count 0 prog_vars. prog_start = "Light Following Robot Program" "Setup" -- Send left light sensor reading into right motor -- on channel 160 gvr b1 -50 75 160 -- Send right light sensor reading into left motor -- on channel 170 gvr b2 -50 75 170 prog_start. prog_loop = patdog prog_loop. prog_stop = -- Stop the program. print "Prog End!" -- Clear the gvr commands boff -- Stop the motors stop prog_stop.

  • Sine Wave Plot Program

    < Back Sine Wave Plot Program This program uses the lbar command to plot a sine wave. Program --- Plot a sine wave with the lbar command. --- prog_vars = d/run_no 0 d/angle 0.0 d/raw_sin 0.0 d/sin_value 0.0 prog_vars. prog_start = print "Plot a sine wave" prog_start. prog_loop = -- Calc sine of the abgle sin /angle -> /raw_sin -- Scale the Sine wave to fit. mapf -1 1 0 50 /raw_sin -> /sin_value -- Plot the sine wave. tbar * /sin_value 25 40 "Sine /angle = /sin_value" inc /angle 0.1 -- 0.1 best -- Check if we should exit. any /run_no > 100 -> exitprog inc /run_no prog_loop. prog_stop = print "Good bye" prog_stop.

  • Maths Functions Example

    < Back Maths Functions Example This is a small program showing the various maths functions in Octagon. Program --- Maths Functions Program Example --- prog_vars = d/a 10 -- integer var set to 10 d/b 100 -- integer var set to 100 d/c -3.141 -- float var set to -3.141 d/result 0.0 -- float to hold total prog_vars. prog_start = print "Maths Example Program no 1" prog_start. prog_loop = -- Display system var /pi print "Pi is /pi" add /a /b /c -> /result -- Add some numbers print "adding /a /b /c = /result" -- Set new value of /c /c 1.5 -- Subtract some numbers sub /a /b /c -> /result print "subtracting /a /b /c = /result" -- Multiply some numbers mul /a /b /c -> /result print "multiplying /a /b /c = /result" -- Divide some numbers div /a /b /c -> /result print "dividing /a /b /c = /result" -- Root of pi sqrt /pi -> /result print "root of pi is /result" -- New Values /a 25|/b 50|/c 100.0 -- Average of some numbers ave /a /b /c -> /result print "ave /a /b /c = /result" -- Analyse some numbers min /a /b /c -> /result print "min of /a /b /c is /result" max /a /b /c -> /result print "max of /a /b /c is /result" -- Hash of pi hash /pi -> /result -- Get a random number between 0 and 1000 rand 0 1000 -> /result print "Random number /result" print "Done exiting now!" exitprog prog_loop. prog_stop = exitprog prog_stop.

  • Sensors - Infrared Obstacle Avoidance

    < Back Infrared Obstacle Avoidance This unit will detect the presence of objects at distances of between about 2cm to 30cm. The Infrared Obstacle Avoidance Sensor will detect the presence of objects at distances of between about 2cm to 30cm. It uses an infrared emitting diode to send out an IR signal. Should the signal hit a nearby surface, it will be reflected back to the sensor and the output will go low or to 0V. The potentiometer is used to adjust the sensitivity of the sensor. Turning it anticlockwise will reduce the detection range so it detects closer objects, turning it clockwise increases the sensitivity and it will detect objects farther away. 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 100-degree-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. Sensor Pins The table below lists the pins of the sensor. 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 a 5V supply to work. It needs 3 female to female jumper wires to connect to the JackBord. The output of the sensor can be connected to any of the pins on ports A, B or C. You need the following items: The sensor 3 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 below. 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 to jumper to the rightmost pin of the sensor, note this is with the sensor facing up as in the picture on the left. Connect a green or black jumper wire to the center ground pin. Connect a jumper for the output to the left 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. 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 pictures below and make sure they match. 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. 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). 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 bts command. The USER LED will turn off once the object leaves the field and this is because of the btr command. If needed clear any current button setup using the rstb command. btp a1 l1 1 btr a1 l1 0 Previous Next

  • Add Numbers

    < Back Add Numbers This program takes the /count variable and uses the add_numbers task to add /count to itself. Thus the result is always 2 x /count. It does this by calling the add_numbers task and providing the /count variable as the two input arguments. And the result of the addition is pushed into the /count_sum variable, as shown below: add_numbers /count /count -> /count_sum The tasks input arguments are /count /count and the output argument is /count_sum. Program --- Add Numbers Program --- prog_vars = d/count 0 d/count_sum 0 prog_vars. prog_start = pclear print "Add Numbers Program Start" prog_start. prog_loop = -- main program loop -- Add the /count to itself. add_numbers /count /count -> /count_sum -- Next number inc /count -- Check if we are done any /count >= 10 -> exitprog prog_loop. add_numbers /a 0 /b 0 -> /total 0 = add /a /b -> /total print "Sum of /a and /b is /total" add_numbers. prog_stop = print "Bye" prog_stop.

  • Counting

    < Back Counting This program lists the numbers from 0 to 10 and exits. Program --- Counting Program Lists the numbers from 0 to 10. --- prog_vars = d/count 0 prog_vars. prog_start = print "Counting Program Start" prog_start. prog_loop = -- Main program loop -- Increment the value of the /count var by 1 inc /count -- Display the new count print "Count /count" -- Decide if it's time to exit any /count >= 10 -> exitprog prog_loop. prog_stop = print "Bye" prog_stop.

  • Raspberry Shake Quake Alert

    < Back Raspberry Shake Quake Alert Raspberry Shake Quake Alert Program This program gets the Raspberry Pi Shakes geophone EHZ channel and d-trends it before plotting it. It also lets you set an alert threshold such that when the geophone value goes above the threshold an alert message is displayed. Program --- Raspberry Shake Quake Alert Program This program gets the Raspberry Pi Shakes geophone EHZ channel and detrends it before plotting it. Set an alert threshold for the alarm to be triggered. --- prog_vars = d/count 0 d/xpos 0 -- Processed Geophone Sensor Value -- This has been detrended d/pro_EHZ 0.0 d/prev_EHZ 0.0 prog_vars. prog_start = pclear d500 -- Display the Title. ptl 100 1 ^ts=24^tc=blue^ "Raspberry Shake Alert Program" -- Add Quit Button pb 25 50 ^n=Quit^p=exitprog^ prog_start. prog_loop = -- main program loop inc /count -- Stop after 10,000 readings any /count >= 10000 -> exitprog -- Ignore the first few readings so the de-ttending can work any /count >= 3 -> -- Get a fresh set of readings from the shake -- grsk AM.R5C47 grsk AM.R7DD4 -- Wait a while for next readings -- NEED this delay. d250 -- d-trend the reading sub /rs_EHZ /prev_EHZ -> /pro_EHZ -- Invert the negative values abs /pro_EHZ -> /pro_EHZ -- Plot the pro_EHZ geophone value plot 10 150 ^id=rs^t1n=Z^t2n=E^t3n=N^xp=/xpos^v1=/pro_EHZ^ -- Display the plot value ptl 30 100 ^ts=16^ "X /xpos > EHZ /rs_EHZ pro EHZ /pro_EHZ " -- Check for a Quake any /pro_EHZ >= 500 -> -- YES we have a quake ptl 100 40 ^ts=25^tc=red^ "Tapapa Hopukina Kia mau" else -- NO no quake ptl 100 40 ^ts=25^tc=Lime^ "OK" enda. -- Next Xpos inc /xpos enda. -- Update the previous value. /prev_EHZ /rs_EHZ prog_loop. prog_stop = ptl 25 25 ^ts=75^ "Bye" prog_stop.

  • getline Example

    < Back getline Example This program prompts the user for their name and displays it to them. It uses the getline command to get the users input from the command line. Program --- Name Program get the users name and display it --- prog_vars = d/name "" prog_vars. prog_start = print "Name Program" prog_start. prog_loop = print "What is your name?" getline -> /name print "Your name is: /name hello /name" exitprog prog_loop. prog_stop = print "bye /name" prog_stop.

  • Button Task

    < Back Button Task This program displays a button on the Show page and displays the number of times it has been pressed in real time. It runs a task called b_press each time the button is pressed. Program --- Button Task Program --- prog_vars = d/count 0 prog_vars. prog_start = pclear print "Button Task Program Start" -- Set button to run b_press task when pressed. pb c c ^p=b_press^n=Run Task^ b_press prog_start. prog_loop = -- main program loop patdog prog_loop. b_press = inc /count ptl c d "Button Presses /count" b_press. prog_stop = print "Bye" prog_stop.

  • RC Servo Demo

    < Back RC Servo Demo This program steps the servos shaft from 0 to 180 degrees and back to 0 in 10deg steps. The servo is connected to port A1. Print the arm angle in the print tab. This goes with the Using RC Servos Part 2 video Program --- RC Servo Demo 1 THis program steps the servos shaft from 0 to 180 degrees and back to 0 in 10deg steps. The servo is connected to port A1. Print the arm angle in the print tab. --- prog_vars = d/count 0 d/arm_angle 0 prog_vars. prog_start = pclear svp a1 0 print "RC Servo Demo 1: Start" prog_start. prog_loop = -- main program loop -- 0 to 180 repeat 18 -> svp a1 /arm_angle "Arm Angle /arm_angle" inc /arm_angle 10 d50 repeat. -- 180 to 0 repeat 18 -> svp a1 /arm_angle "Arm Angle /arm_angle" dec /arm_angle 10 d50 repeat. -- exit the program exitprog prog_loop. prog_stop = print "Bye" svp a1 0 prog_stop.

  • Smart Led Example

    < Back Smart Led Example This program will use the sled command in two ways. For this program you need a strip of 4 smart LEDs connected to port pin C5 of the JackBord. This program will set 4 LEDs to colors 1, 2, 3 and 4 respectively and do it live, so the LEDs will update as the program runs. Note there is a 1 second delay between each LED being set. In the second test the LEDs are set to the same colors with the same 1 second delay, except that we added the 0 at the end of each sled command. This tells the JackBord NOT to update the LEDs in real time and instead they all get turned on in one go at the end when the uled command is run. This shows the effect of the uled command. The program will run a few times and stop. Program --- Smart Led Example Program No 1 --- prog_vars = d/count 0 prog_vars. prog_start = pclear print "Setup Program" -- Setup 4 smart LEDs sledn 4 prog_start. prog_loop = -- Update the LEDs as we go. "Test 1 Update live" sledoff sled 1 1 d500 sled 2 2 d500 sled 3 3 d500 sled 4 4 d500 sledoff -- Update the LEDs at the end. "Test 2 Update at end." sled 1 1 0 d500 sled 2 2 0 d500 sled 3 3 0 d500 sled 4 4 0 d500 -- Update ALL LEDs in one go. usled dly 1000 sledoff inc /count any /count >= 3 -> exitprog prog_loop. prog_stop = print "Bye" sledoff prog_stop.

bottom of page