top of page

Search Results

255 items found for ""

  • Combining any and all Statements Together Example

    < Back Combining any and all Statements Together Example In this example program we combine any and all statements to make more complex decisions possible in Octagon. Program --- Combining any and all statements example program --- prog_vars = d/pin1 0 d/pin2 1 d/pin_no 0 prog_vars. prog_start = print " -------------- " print "any and all combination example program" prog_start. prog_loop = -- Test 1 Should be FALSE ie /pin_no < 1 /pin1 0 /pin2 1 /pin_no 0 all /pin_no >= 1 /pin_no <= 5 any /pin1 = 0 /pin2 = 1 -> print "Test 1 TRUE WRONG" else print "Test 1 FALSE CORRECT" exitprog enda. -- Test 2 Should be FALSE ie /pin_no > 5 /pin1 0 /pin2 1 /pin_no 10 all /pin_no >= 1 /pin_no <= 5 any /pin1 = 0 /pin2 = 1 -> print "Test 2 TRUE WRONG" else print "Test 2 FALSE CORRECT" exitprog enda. -- Test 3 Should be FALSE ie all anys are false /pin1 1 /pin2 0 /pin_no 3 all /pin_no >= 1 /pin_no <= 5 any /pin1 = 0 /pin2 = 1 -> print "Test 3 TRUE WRONG" else print "Test 3 FALSE CORRECT" exitprog enda. -- Test 4 Should be TRUE ie all is ok and 1 any is true /pin1 0 /pin2 0 /pin_no 3 all /pin_no >= 1 /pin_no <= 5 any /pin1 = 0 /pin2 = 1 -> print "Test 4 TRUE CORRECT" else print "Test 3 FALSE WRONG" exitprog enda. -- Test 5 Should be TRUE ie all is ok and 1 any is true /pin1 1 /pin2 1 /pin_no 3 all /pin_no >= 1 /pin_no <= 5 any /pin1 = 0 /pin2 = 1 -> print "Test 5 TRUE CORRECT" else print "Test 5 FALSE WRONG" exitprog enda. prog_loop. prog_stop = print "Bye" prog_stop.

  • WiFi Signal Strength using ant

    < Back WiFi Signal Strength using ant This program uses the /wifisig system variable to display how good the Wifi signal the JackBord has is. It uses the ant statement to determine which message to display based upon the strength of the Wifi signal. Program --- Wifi Signal Strength Program using ant. This uses the /wifisig system variable and the ant command to check the wifi strength, and then tell you about it. NOTE: Each time the /wifisig system variable is used it updates the wifi signal reading, so they will vary. --- prog_vars = d/wifi_state "" d/wifi_sig 0 d/runs_to_do 0 d/runs_done 0 d/current_wifi 0 prog_vars. prog_start = print "Wifi Signal Strength Program" /runs_to_do 10 prog_start. prog_loop = -- Reset the wifi state var and get the wifi -- signal level from the /wifisig sys var. /wifi_state "XXX" -- Get the wifi signal strength here once as it can -- change on subsequent calls to the /wifisig sys var. /current_wifi /wifisig ant /current_wifi -> <= -85 -> /wifi_state "Not Good" <= -80 -> /wifi_state "TOO LOW!" <= -70 -> /wifi_state "LOW" <= -60 -> /wifi_state "WORSE" <= -50 -> /wifi_state "BETTER" <= -40 -> /wifi_state "GOOD" <= -30 -> /wifi_state "V GOOD" -> /wifi_state "NO Signal" ant. print "Wifi /wifi_state /current_wifi" any /runs_done = /runs_to_do -> exitprog inc /runs_done d1 0 prog_loop. prog_stop = print "Good bye" 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.

  • Button Press Command Task Call Test

    < Back Button Press Command Task Call Test Button Press Command Task Call Program --- Button Press Command Task Call Test Program 18 Sep 2020 --- prog_vars = d/count 0 d/total_presses 0 d/cat 0 d/dog 0 prog_vars. prog_start = print "prog started" /d1 0 rdbg 7 bdbg 5 pticks 1 chup 50 -- Set Port A1 as an input with a pullup btp a1 left_side btp a2 right_side prog_start. prog_loop = patdog inc /count patcat get a1 bms 50 prog_loop. left_side = inc /total_presses "Left /total_presses" tg c1 test_cat left_side. right_side = inc /total_presses "right /total_presses" tg c2 test_dog right_side. test_cat = inc /count inc /cat "CAT count /count cat /cat" test_cat. test_dog = dec /count inc /dog "DOG count /count dog /dog" test_dog. prog_stop = print "prog stopped" prog_stop.

  • Simple Gauge Program

    < Back Simple Gauge Program This program uses a gauge to display the value of a voltage being applied to pin A1. We scale the input voltage to be between 0 and 100. Connect the TOP so that POT1 is across 3V and ground and the center pin goes to pin A1 on the JackBord. Turning the pot will change the gauge reading. Program --- Simple Gauge Program This program uses a gauge to display the value of a voltage being applied to pin A1. --- prog_vars = d/count 0 prog_vars. prog_start = pclear print "Program Start" -- show the title ptl 10 10 ^ts=26^ "Simple Gauge Program" -- Add a quit button pb 500 10 ^n=Quit^p=exitprog^ -- Setup port pin A1 to be an anaog input and scale between 0 to 100. gvr a1 0 100 prog_start. prog_loop = -- main program loop -- show the gauge pg 50 100 /a1 ^min=0^max=100^n=Value^ inc /count prog_loop. prog_stop = print "Bye" ptl 350 50 ^ts=34^ "Bye" prog_stop.

  • Octagon Long Argument Test

    < Back Octagon Long Argument Test This is a test program for the task arguments in Octagon. Program --- Hi Octagon --- prog_vars = d/count 1 prog_vars. prog_start = print "My 1st Program" pticks 5 /count 0 rdbg 8 cdbg 5 prog_start. prog_loop = print "Hi from Octagon. /count" inc /count repeat 5 -> print "REP1 count /count" tg a1|tg a5|d1 1 repeat 5 -> print "REP2 count /count"|tg d1|tg a1|tg a5|inc /count -- repeat 5 -> tg d1|tg a1|tg a5 -- repeat 5 -> tg a1 repeat 5 -> tg a1|print "1>Time to quit count /count end" repeat 5 -> print "2>Time to quit count "|tg a5 tg d1 -- Works repeat 5 -> tg a5|inc /count|print "3>Time to quit count /count end" -- Works repeat 5 -> print "4>Time to quit count /count end" tg a5 repeat. -- Arg too long repeat 5 -> tg a5|inc /count|print "3>VERY LONG ARG Time to quit count /count"|tg d2 -- Arg too long at end. repeat 5 -> tg a5|tg d2|inc /count|print "3>VERY LONG ARG Time to quit count /count AT END" -- DOES NOT WORK repeat 5 -> print "5>Time /count end"|tg a1 repeat. -- Does NOT WORK repeat 5 -> print "6>Time to quit count /count end"|tg a5 tg d2 repeat 4 -> print "this is repeat 4" tg a1 repeat. -- any /count >= 15 -> print "Time to quit count /count end"|exitprog any /count >= 15 -> print "7>Time to quit count /count end"|tg a5|exitprog prog_loop. prog_stop = print "Prog STOPPED!" prog_stop.

  • Projects - Electronic Dice

    < Back Electronic Dice In this project, you will build on the Rainbow LED project by turning the JackBord into a dice. Using the random function to generate a number and assigning each LED a value (all 5 lit up represents six) makes a very simple electronic dice. Just like the Rainbow LED Display project, we use the same circuit and connect the TOP LEDs to Port A on the JackBord. This time we control the LEDs via a program rather than the command line. This means that we don’t have to manually enter commands every time we want the LEDs to light up, but the program also allows us to give the LEDs a practical function which is, in this case, giving a number between 1 and 6. PDF INSTRUCTIONS Project Gallery

  • Vector Graphics Test

    < Back Vector Graphics Test ​ Program --- Vector Graphics Test Program. --- prog_vars = d/count 0 d/xpos 0 d/ypos 0 d/text_to_show "Jack is a very good boy" prog_vars. prog_start = print "Program Start" gvr b1 0 100 pclear ptl 100 200 "Some Text 100 200 /text_to_show" ptl 0 0 "Letter Position 0 0 /text_to_show" ptl a a "Letter Position a a /text_to_show" ptl z z "ZZ Letter Position z z /text_to_show" ptl m i "Letter Position m i /text_to_show" -- Rectangle pr 80 123 100 100 ^id=r1^width=2^fill=red^color=blue^round=2^ pr 180 223 100 50 ^id=r1^width=5^fill=lime^color=brown^round=2^ -- exitnow -- Button pb j j ^name=d1 2^press=d1 1|d2 1^rel=doff^ pb o j ^name=c1 2^press=c1 1|c2 1^rel=coff^ pb l l ^name=Clear^press=pclear^ -- Circle pcr 140 300 20 ^id=c8^width=2^fill=red^color=blue^ -- Vertical Line pvl b 100 60 ^width=20^color=blue^lcap=rect^ pvl e 100 60 ^width=20^color=blue^lcap=round^ pvl i 100 60 ^width=20^color=blue^lcap=square^ -- Horizonbtal Line phl i j 60 ^width=20^color=blue^lcap=rect^ phl i k 60 ^width=20^color=blue^lcap=round^ -- Button pb j j ^name=d1 2^press=d1 1|d2 1^rel=doff^ -- ptl with Tags ptl 100 100 ^size=24^font=Arial^ "Some Text 100 100" prog_start. prog_loop = -- main program loop print "Count /count" -- Display B1 pvl j 100 /b1 ^id=b1^width=20^color=yellow^lcap=rect^ ptl j 120 ^id=tb1^ "b1 /b1" any /count < 20 -> inc /count ptl /xpos /ypos "Count /count" -- Circle pcr 140 300 /ypos ^id=c8^width=2^fill=red^color=blue^ inc /xpos 25 inc /ypos 25 enda. any /count >= 200 -> exitprog prog_loop. prog_stop = print "Bye" prog_stop.

  • Personal Weather Station

    < Back Personal Weather Station This is a basic weather station that measures air temperature and relative humidity. Program --- Personal Weather Station --- prog_vars = d/count 0 d/air_temp 0.0 d/rh 0 prog_vars. prog_start = pclear print "Weather Station Program Start" i2con d1000 f2c pb 100 50 ^n=Quit^p=exitprog^ ptl 20 0 ^ts=24^ "My Weather Station" prog_start. prog_loop = -- main program loop /air_temp /35 /rh /36 ptl 100 100 ^ts=24^tc=red^ "Air Temp /air_temp" ptl 100 150 ^ts=24^tc=blue^ "RH /rh" prog_loop. prog_stop = print "Bye" prog_stop.

  • Flash USER LED Using a Recursive Task

    < Back Flash USER LED Using a Recursive Task This is an example of how to use recursion as a loop in a program. The program will call a task called flash_user_led and once there the task calls itself 10 times resulting in the USER LED flashing random colors. Once the LED has flashed 10 times the skipout command is called and the program will end. Program --- Flash USER LED using a recursive task. --- prog_vars = d/color 0 d/flash_count 0 prog_vars. prog_start = pclear print "Recursive flash program." prog_start. prog_loop = flash_user_led 5 exitprog prog_loop. flash_user_led /start_count 0 = -- Get a new random color rand 0 15 -> /color -- Set USER LED to the color l1 /color "Flash no /flash_count color /color start /start_count" inc /flash_count -- Check if we should stop any /flash_count >= 10 -> "Time to Stop" skipout enda. -- Recursively call again flash_user_led 8 "ERROR WE SHOULD NOT BE HERE" flash_user_led. prog_stop = print "Exit Twinkle" prog_stop.

  • Plot a Voltage Program

    < Back Plot a Voltage Program This program uses a graph plot to display the value of a voltage being applied to pin A1. We scale the input voltage to be between 0 and 100. Program --- Simple Plot Program This program uses a graph plot to display the value of a voltage being applied to pin A1. We scale the input voltage to be between 0 and 100. --- prog_vars = d/Xpos 0 prog_vars. prog_start = pclear print "Program Start" -- show the title ptl 10 10 ^ts=26^ "Simple Plot Program" -- Add a quit button pb 500 10 ^n=Quit^p=exitprog^ -- Setup port pin A1 to be an anaog input and scale between 0 to 100. gvr a1 0 100 prog_start. prog_loop = -- main program loop -- Plot the current value plot 0 50 ^id=V1^n=Voltage^xn=Time^t1n=Volts^xp=/Xpos^v1=/a1^ inc /Xpos d250 prog_loop. prog_stop = ptl 350 0 ^ts=34^ "Bye" prog_stop.

  • Repeat Command Test

    < Back Repeat Command Test This test program use repeat in all of the various manners it can be used in. Program --- Repeat Command Test Program --- prog_vars = d/count 1 d/rand_no 0 d/servo_pos 0 d/do_reps 0 prog_vars. prog_start = print "Repeat Test Program" pticks 5 /count 0 /rand_no 0 prog_start. prog_loop = print "Main Loop /count" inc /count -- flash user led 10 times with 50ms delay. repeat 10 -> pulse d1 50 -- Print rand no -100 to 100 rand -100 100 -> /rand_no|print "RND1 /rand_no" -- Display 5 random numbers between 1 - 100 repeat 5 -> rand 1 100 -> /rand_no|print "RND2 /rand_no" repeat 5 rand 1 100 -> /rand_no print "RND3 /rand_no" repeat. -- Exit the repeat if we get a rand no > 25 repeat 5 rand 1 100 -> /rand_no print "RND4 /rand_no" any /rand_no > 25 -> print "Exit rep"|skipout repeat. -- Flash some lights repeat 10 -> tg a1|tg a5|tg d1 -- Step a servo through 180 deg use 18 reps div 180 10 -> /do_reps repeat /do_reps -> print "Servo pos /servo_pos" -- Set the servo position. svp a1 /servo_pos -- Leave the repeat early. any /servo_pos >= 9 -> skipout -- Inc the /servo_pos by 10 inc /servo_pos 10 repeat. -- exit after 15 runs. any /count >= 15 -> print "Qu /count"|exitprog prog_loop. prog_stop = print "Prog STOPPED!" prog_stop.

  • Sheep Dog Program

    < Back Sheep Dog Program This program works out how many sheep dogs are required to look after a given number of black and white sheep. Program --- Sheep Dog Program --- prog_vars = d/white_sheep 0 d/black_sheep 0 d/total_sheep 0 d/runs_to_do 10 d/runs_done 1 d/colors[] "" prog_vars. prog_start = print "Sheep Program." print "No of runs to do /runs_to_do" -- Setup the colors /colors[1] "Black" /colors[2] "White" prog_start. prog_loop = -- Get more sheep, and see what color they are. get_sheep -> /qty_of_sheep /color "/runs_done > New Sheep qty /qty_of_sheep color /colors[/color]" -- Check the type of sheep, update respective count any /color = 1 -> -- update black sheep add /black_sheep /qty_of_sheep -> /black_sheep else -- update white sheep add /white_sheep /qty_of_sheep -> /white_sheep enda. -- Update the total no of sheep add /white_sheep /black_sheep -> /total_sheep -- Check how many sheep dogs we need for the sheep check_dogs /total_sheep -> /dogs_needed -- Check if its time to exit yet any /runs_done >= /runs_to_do -> exitprog enda. -- Next run inc /runs_done prog_loop. get_sheep -> /qty_of_sheep 0 /color 1 = --- Returns a random quantity of sheep, of a random color. --- rand 0 100 -> /qty_of_sheep -- Get the color of this batch of sheep. -- 1 = black 2 = white rand 1 2 -> /color get_sheep. check_dogs /no_of_sheep 0 -> /dogs_needed 0 = --- Calc the number of sheep dogs we need to manage this many sheep. Return the no of dogs we need. --- mul 0.1 /no_of_sheep -> /dogs_needed check_dogs. prog_stop = -- display the final results print "We need /dogs_needed dogs to manage them" print "Total sheep /total_sheep" print "Black /black_sheep White /white_sheep" print "Exit Prog" prog_stop.

  • Octagon Drawing Example

    < Back Octagon Drawing Example This program draws various shapes on the Show page and is a good way of getting started with the drawing commands in Octagon. Program --- Octagon Drawing Program --- prog_vars = d/step 0 d/color 0 d/opacity 1.0 d/arc_angle 0 d/arc_radius 0 prog_vars. prog_start = pclear ptl f a ^ts=20^tf=verdana^ "JackBord Oactagon Drawing Program" psq t e 100 ^fc=red ^ pcr t h 50 ^fc=cyan ^ prect o j f e ^fc=yellow ^lc=yellow^lw=5^ prog_start. prog_loop = -- main program loop repeat 35 -> pal /step /step /step /step ^lc=/color ^op=/opacity ^lw=50^ mapi 0 520 0 360 /step -> /arc_angle mapi 0 520 0 100 /step -> /arc_radius parc 400 200 /arc_radius 0 /arc_angle ^lc=/color ^fc=transparent^lw=16^ inc /step 15 dec /opacity 0.05 any /opacity <= 0 -> /opacity 1.0 inc /color any /color >= 15 -> /color 1 ptl t c "step /step" repeat. exitprog prog_loop. prog_stop = print "Bye" prog_stop.

  • Projects - Soccer Robot

    < Back Soccer Robot In this project, you will use your JackBord to play soccer! We do this by turning an ice cream container into a scoop or a foot so the JackBord can push a ball from one point to another. This project also includes different ways you can play and different challenges you can implement in order to make driving and scoring more difficult for your robot. One of these challenges includes programming the buttons on the DRIVE page on the dashboard, and then using these buttons to control your soccer robot. PDF INSTRUCTIONS Project Gallery

bottom of page