Search Results
285 results found with an empty search
- Sheep Dog Program
This program works out how many sheep dogs are required to look after a given number of black and white sheep. < 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.
- Colour Plot
This program uses a variable resistor on Port pin A1 to control the color of the USER LEDs and plot the values as well. < Back Colour Plot This program uses a variable resistor on Port pin A1 to control the color of the USER LEDs and plot the values as well. Program --- Color Plot Program Uses a variable resistor on Port pin A1 to control the color of the USER LEDs and plot the values as well. --- prog_vars = d/color 0 d/xpos = 0 prog_vars. prog_start = pclear ptl 50 10 ^ts=24^ "Color Program Start" -- Setup the analog input gvr a1 200 500 pb 50 50 ^n=Quit^p=exitprog^ prog_start. prog_loop = -- main program loop print "Xpos /xpos" inc /xpos 2 any /xpos >= 600 -> pclear|/xpos 0 -- Plot the Point pp /xpos /a3 ^lw=2^fc=/color ^lw= /color ^ -- Set the User led colors mapi 200 500 0 15 /a3 -> /color l1 /color l2 /color l3 /color prog_loop. prog_stop = ptl 200 200 ^tc=red^ts=24^ "Bye" prog_stop.
- Personal Weather Station
This is a basic weather station that measures air temperature and relative humidity. < 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
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. < 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.
- 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. < 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.
- 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. < 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.
- Contact Us | Jackbord
Learn about how JackBord can help young learners of all ages and abilities become tomorrrow's innovators, scientists and engineers Contact Us We'd love to hear from you Please give us your feedback about any issues, complaints, praise and suggestions We are always looking to improve as we aim to make your JackBord experience as best as it can be Thank you Email info@jackbord.works Proudly created and made in Kapiti, New Zealand Please submit your feedback below. First Name Last Name Code Phone Email Feedback Type Praise Question Suggestion Bug Report Complaint General Comments Send Thanks for submitting!
- Sensors - RGB Colour
Detects the RGB (red, green and blue) colours of an object. < Back RGB Colour Detects the RGB (red, green and blue) colours of an object. The RGB Colour Sensor detects the RGB (red, green and blue) colors of an object. Quick Commands Setup the i2c system by typing: i2con Once the command has run the color sensor should be detected. Now you can view the colors from the sensor on the command line by typing this command: jp "red /cs_red green /cs_green blue /cs_blue clear /cs_clear" Videos RGB Color Sensor Part 1: Introduction RGB Color Sensor Part 2: Using the sensor NOTES AND CAUTIONS The sensor has a short range of about 2cm, ideally the object to be measured should be up against the sensor if the sensors LED light is on. The sensor has a built in LED that is controlled from pin 5 on the USI. Setting the pin high turns the LED on and setting it to 0 turns it off. Connection Example Parts of the Sensor The main parts of the sensor are shown in this photograph. First of all we have the sensor on the far left, this is where the RGB elements are that detect the colors. The sensor has a number of pins the main ones being the red power supply pin which needs to be 5 volts, the green ground pin, the blue serial clock pin, the white serial data pin and the LED control pin. Looking at the lower image you can see the RGB sensor in the center and slightly below that you can see the LED light the purpose of which is to eliminate the subject whose color you're trying to detect. The LED input can be used to turn the LED light on and off from the JackBord. How it Works As you may already know the white light that we see every day is actually composed of several different colors which is where the rainbow comes from. For electronics and robotics we rely on the fact that most colors we can see can be created from just three base colors red green and blue. If we mix these colors as shown in the picture below we derive other colors such as yellow. You can also see at the center, when we combine all three colors we end up with white. The Sensor At the center of the sensor is a small IC or integrated circuit that has a number of light sensors on it. These are sensitive to ambient light or normal light, red, green and blue light. You can see the color sensor IC in the picture below, above the white LED. You can use these values to determine the color of the object the sensor is looking at. For example if we are getting equal values of red and green and the blue value is much lower this means the object is most likely yellow. This is because yellow light it maid up of red and green. Communications The sensor uses a special protocol called I2c to communicate with the JackBord on port D. Input and Output Pins: The pins of the sensor are listed below: Connecting the Sensor to the JackBord To make it easier to connect the sensor to the JackBord we locate it at port D using an M4 bolt and nut. This is because the sensor needs to use the JackBord's i2c port and this is located at port D. This is shown in the picture below. Connecting the Jumper Wires The diagram below shows how the sensor should be connected to port D of the JackBord. Note that the INT line is not needed. Steps: First take a green jumper wire and connect it to the ground pin on the JackBord and then to the green ground pin on the sensor Next we take a red jumper wire and connect it from the 5 volt power supply pin on port D of the JackBord and connect it to red 5 volt power supply pin on the sensor. Take a blue jumper wire and connect it from the blue pin on the sensor to port pin d4 of the JackBord Take a white jumper wire and connect it from the white pin on the sensor to port pin d5 of the JackBord Finally use a black jumper wire to connect the black LED pin on the sensor to port pin d1 on the JackBord. We will use Port D pin 1 on the JackBord to control the sensor's built in LED light. The jumper wire colors you use don't have to exactly match those shown above, the main thing is each jumper needs to connect to the correct pin on the sensor and the JackBord. Using the Sensor The sensor has a number of detectors that measure the amount of light in clear, red, green and blue. The clear value is the overall amount of light which is a combination of all the colors together. While the 3 other values are for their respective colors only. Accessing the Color Values In Octagon there are a number of system variables used with this sensor: You can display the values from the sensor using the print statement below in an Octagon program: print "Clear /cs_clear Red /cs_red Green /cs_green Blue /cs_blue" Controlling the Sensors LED Light When the sensors LED light pin is at 0V or connected to ground the light will be turned off. When its high i.e. connected to 3V the LED will be turned on. If the LED line is connected to pin d1 on the JackBord you can turn it on by turning pin d1 on by typing this command: d1 1 and you can turn it off with this command: d1 0 Previous Next
- Moving Circle
Use the TOP to connect the POT1 to pin A1 and POT2 to pin A2. The LEFT POT will control the balls position on the X-axis and the RIGHT POT will control the balls position on the Y-axis. < Back Moving Circle Use the TOP to connect the POT1 to pin A1 and POT2 to pin A2. The LEFT POT will control the balls position on the X-axis and the RIGHT POT will control the balls position on the Y-axis. Program --- Moving Circle Program Use the TOP to connect the POT1 to pin A1 and POT2 to pin A2. The LEFT POT will control the balls position on the Xaxis and the RIGHT POT will control the balls position on the Yaxis. --- prog_vars = d/count 0 d/display_width 874 d/display_height 630 prog_vars. prog_start = pclear print "Moving Circle Program" gvr a1 0 /display_width -- Y-axis up and Down gvr a2 0 /display_height -- Xaxis left and right prog_start. prog_loop = -- main program loop -- Display the X and Y values ptl 10 10 "X /a1 Y /a2" -- Display the orange ball on the Show page at the position -- set by the values of A1 and A2. pcr /a1 /a2 50 ^id=cat^fc=orange^ prog_loop. prog_stop = print "Bye" prog_stop.
- Capacitor Charge Discharge Plot
Use a 100K Resistor with a 10uF capacitor. Use A1 to monitor the capacitor voltage. A2 charges the capacitor. < Back Capacitor Charge Discharge Plot Use a 100K Resistor with a 10uF capacitor. Use A1 to monitor the capacitor voltage. A2 charges the capacitor. Program --- Capacitor Charge Discharge Plot Program Use a 100K Resistor with a 10uF capacitor. Use A1 to monitor the capacitor voltage. A2 charges the capacitor. --- prog_vars = d/count 0 prog_vars. prog_start = pclear d1000 ptl 10 5 ^ts=24^ "Capacitor Program" gvr a1 0 100 a2 0 ptl 10 50 "Wait for Disacharge" dly 3000 ptl 10 50 ^tc=lime^ "Charge" a2 1 plot 10 100 ^xp=/count ^n=A1 Volts^v1= /a1 ^ prog_start. prog_loop = plot 10 100 ^xp=/count ^v1= /a1 ^ inc /count any /count >= 100 -> exitprog dly 25 -- Discharge any /a1 >= 95 -> /a2 0 ptl 10 50 ^tc=red^ "Discharge" enda. prog_loop. prog_stop = ptl 10 50 ^tc=red^ "Finished" a2 0 prog_stop.
- Sine Wave Plot Program
This program uses the lbar command to plot a sine wave. < 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.
- Projects - 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. < 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
- Plot Sine Wave on Show Page
This program plots a sine wave using the Show page. < Back Plot Sine Wave on Show Page This program plots a sine wave using the Show page. Program --- Store and Plot Sine Wave. Generate the values for a sine wave, store in an array and then plot them. --- prog_vars = d/point_no 0 d/current_angle 0.0 d/sine_value 0.0 d/plot_value 0 prog_vars. prog_start = pclear print "Plot a Sone wave" prog_start. prog_loop = plot_sine 100 0.0 exitnow prog_loop. plot_sine /no_of_points 0 /start_angle 0.0 = -- Generate the sine wave data points and plot them. print "Plot /no_of_points of Sine Wave" /current_angle /start_angle -- Loop through and plot the points repeat /no_of_points -> -- Calc the sine of the /current_angle sin /current_angle -> /sine_value -- Scale the Sine wave to fit. mapf -1 1 -50 50 /sine_value -> /plot_value plot 0 50 ^id=sine^w=500^h=200^xp=/point_no ^v1=/plot_value ^title=Sine Wave^ -- Next angle inc /current_angle 0.5 inc /point_no repeat. plot_sine. prog_stop = print "Good bye" prog_stop.
- Ant Command Test
This is a test for the ant command. < 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.
- Sensors - Capacitive Soil Moisture
This analog capacitive soil moisture sensor measures soil moisture by detecting the change in capacitance that stems from the moisture content of the surrounding soil. The output of the sensor is a voltage between 0V and 3V, with 0V being very dry soil and 3V being wet soil. < Back Capacitive Soil Moisture This analog capacitive soil moisture sensor measures soil moisture by detecting the change in capacitance that stems from the moisture content of the surrounding soil. The output of the sensor is a voltage between 0V and 3V, with 0V being very dry soil and 3V being wet soil. This analog capacitive soil moisture sensor measures soil moisture by detecting the change in capacitance that stems from the moisture content of the surrounding soil. The output of the sensor is a voltage between 0V and 3V, with 0V being very dry soil and 3V being wet soil. CAUTION Don't place the sensor in soil or water past the white line The sensor is powered from 5V The JackBord is NOT waterproof, so don't allow it to become wet How the Sensor Works The sensor has an oscillator whose frequency is controlled by capacitance, and this capacitance is affected by the moisture content of the soil in which the sensor is placed. Under dry conditions the sensor's output will be 3V, and as the sensor gets wet the output voltage will fall until it reaches 0V. The type of soil will also influence the readings so some experimentation may be required. Sensor Pins The pins of the sensor are shown below. Note this is the top view. The pins are shown in order starting from the top and moving down. 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 Sensor to the JackBord To make using the sensor easier we have fitted some longer wires which may then be connected to the JackBord via the TOP terminals. So we first need to connect the TOP to the JackBord, then we need to connect the sensor to the TOP Connecting the TOP We will use the JackBord TOP to aid in connecting the sensor to the JackBord. The table below lists the connections we will make. See the pictures below for each step. The connections we will make to the JackBord are given below. The sensor's output will go to pin A1 which will be set as an analog input. Follow these steps. First we will connect the various jumpers to the TOP, make sure that you have your TOP already mounted on the JackBord and that the power wires for the TOP have already been connected. 1. Turn off the JackBord 2. Connect the green jumper wire from ground on the TOP to pin 3 of the TER, this is the 3 pin terminal block at the top of the TOP. 3. Connect the orange jumper wire to TER pin 2, then connect the other end to Port A1. This is the analog output from the sensor. 4. Connect the red jumper wire to the TER pin 1 and the other end to one of the +5V power pins on the top right of the TOP. This will supply power top the sensor. Once you have made the connections check them against the picture below and make sure they match. Now that the TOP is connected to the JackBord we need to connect the sensor to the TOP. Follow the steps below. Connecting the Sensor to the TOP To connect the sensor to the TOP via the terminal follow these steps. You will need a Philips screwdriver for this step to tighten the screws on the terminal block. DO NOT TIGHTEN THEM TOO MUCH. 1. Get the sensors black wire and insert it into the lower hole on the terminal block as shown below, this is TER pin no 3. Tighten up the screw by turning it clockwise. You should not be able to easily pull the wire out of the terminal. 2. Get the sensors yellow wire, this is the analog output wire, and connect it to the second terminal block slot as shown below, this is TER pin no 2. 3. Connect the sensors red wire to pin TER 3 of the terminal block. This is the 5V power supply from the JackBord to the sensor, this is TER pin no 1. Check your connections, they should look like the picture below. Also make sure the terminal block screws are tight enough, but not too tight. Using the Sensor with the JackBord Now that the sensor is connected to the JackBord turn it on and log into your dashboard. A convenient way to represent soil moisture is as a percentage where 0% is very dry and 100% is saturated. But the sensor is the opposite, it puts out 0V for wet and 3V for dry. Thus we need a way of scaling the readings between 0% for dry and 100% for wet. The gvr command will let us get the voltage reading from pin A1 and scale it between 0 and 100 such that the reading will increase with increasing moisture. At the command prompt, type the command below: gvr a1 100 0 This turns pin a1 into an analog input and tells it to scale the voltage readings so they are in the range 100 to 0, where 100 = 0V and 0 = 3V, remember the sensor puts out 0V for high moisture, which we want to be 100%. This is why the 0 and 100 in the gvr command are the opposite way around to what they would normally be. Go to the LIVE page and you should start to see readings from the sensor. Note: It does take a sensor a while to register an increase in soil moisture so don't be surprised if it takes between 20 and 30 seconds to respond. Testing the Sensor In Dry Air First get a reading for dray air, i.e. the sensor is by itself. This will be between 0 and about 10. Ours was 6. In Water: Now get a glass of water and place the sensor in it, be careful the water does NOT go past the line on the sensor, as shown below: BE CARFUL not to get the electronics wet. Now look at the live page and you will see the reading is about 50 to 60, yours will vary but should be about this. Ours was 57. We now have our two extreme readings, these tell us the minimum and maximum values we can expect from the sensor. Now its time to do some tests in soil and see how the sensor responds. In Dry Soil: Get a glass and put some dry soil in it. Make sure the soil level is high enough to reach just below the white line on the sensor. Now look at the readings and see what you get. For ours we got a reading of 18. In Moist Soil: Add some water to the soil, to just wet it but not soak it. Check the reading from the sensor, ours was about 33. In Soaked Soil: For this one add enough water that all of the soil is completely wet but there should NOT be pools of water at the top. Take a reading, ours was 57. In Flooded Soil: This is the last case and for this we add water such that there are pools of it at the top of the soil. This represents the maximum amount of water we can possibly get into the soil. Take a reading, ours was 58 which is about right. Dry Air Reading: Remove the sensor from the wet soil and clean it. Then check the reading has returned to its previous dry air value of about 6. Final Table of Soil Moisture Readings from the Sensor The table below lists the calibration values we got from the sensor. Yours will differ, this can be caused by things like the type of soil etc. Final Calibration Values: The final calibration values we got for our sensor are: These values will be used to set the initial values of the /min_value and /max_value variables in the basic soil moisture program below. https://www.jackbord.org/jobs/basic-capacitive-soil-moisture-sensor Project: Portable Soil Moisture Meter Once you have completed the above and got the sensor working properly, you can use the Basic Soil Moisture Meter Program to turn your JackBord into a stand alone soil moisture meter that will display the soil moisture reading as the color of the USER LED on the front of the JackBord. Run the Program Automatically on Start Up: If you want to have the soil moisture program run on boot use the setboot command to have the JackBord run the soil moisture meter program after its turned on. For example if your program is in program no 8 on the PROG page you would type: setboot 8 From now on the program will run when the JackBord is turned on. To stop running it automatically type: setboot 0 By default the program will take 100 measurements and then exit, to disable this and have it run continually coment out the line below in the code: any /count >= 100 -> exitprog Previous Next
- 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. < 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.
- 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 < 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.
- Sensors - Infrared Obstacle Avoidance
This unit will detect the presence of objects at distances of between about 2cm to 30cm. < 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
- Sensors - Short Range Proximity
This sensor uses an infrared transmitter and receiver to gauge the distance between the sensor and an object near it. It has a digital and an analog output which can be used to control things in response to the presence or absence of an object. < Back Short Range Proximity This sensor uses an infrared transmitter and receiver to gauge the distance between the sensor and an object near it. It has a digital and an analog output which can be used to control things in response to the presence or absence of an object. This sensor uses an infrared transmitter and receiver to gauge the distance between the sensor and an object near it. It has a digital and an analog output which can be used to control things in response to the presence or absence of an object. Quick Commands To get the sensor working, assuming the analog pout is connected to port A a1 and the digital output is connected to a2, enter the commands below at the command prompt. gvr a1 0 100 get a2 The gvr a1 0 100 will result in the value of a1 increasing as an object moves away from the sensor. You can see this change on the LIVE page. Buttons The button press btp and button release btr commands can be used with this sensor. This example uses a button on port a pin a2 and turns the USER LED (l1) on when the sensor detects an object. Removing the object turns it off. btp a2 l1 1 btr a2 l1 0 Videos Getting Started Using the Sensor NOTES AND CAUTIONS: This sensor needs to be adjusted if you want to use the digital output It's maximum range is about 5cm Ambient lighting can affect the performance of the sensor Parts of the Sensor Power LED - Turns on when the power is applied. Detection LED - Turns on when an object is detected. Variable Resistor - Used to adjust the sensitivity of the digital output. Transmitter - The infrared transmitter. Receiver - The infrared receiver. How it Works The transmitter sends an infrared signal and the receiver receives any signal reflected by an object nearby. The closer the objects the stronger the infrared signal that's returned and the lower the output voltage on the analog output. The digital output will go high (3V) when an object is detected and the blue variable resistor sets the trigger threshold for the digital output. Input and Output Pins The sensor has two output pins described below: Connecting the Sensor to the JackBord First bolt the sensor onto port A using an M4 nut and bolt. This is because we're going to use the pins from port A to control the sensor and specifically we need the analog inputs on port A. Take a green jumper wire and connect it to the ground pin on the JackBord and take the other end and connect it to the green ground pin on the sensor. Connect a yellow jumper wire to the 3V pin on the JackBord on port A and then connect the other end to the 3V power input on the sensor. Connect a black jumper wire to the digital output of the sensor and the other end goes to port A pin a2. Connect the analog output of the sensor which is the white pin onto port pin a1 of the JackBord. When you are done it should look like the picture below: Previous Next
- Sensors - BME280 Temperature, Relative Humidity and Pressure
This sensor allows you to measure air temperature, relative humidity and atmospheric pressure. < Back BME280 Temperature, Relative Humidity and Pressure This sensor allows you to measure air temperature, relative humidity and atmospheric pressure. This sensor allows you to measure air temperature, relative humidity and atmospheric pressure. This sensor uses the i2c bus on Port D of the JackBoard. The basic specifications of the sensor are shown below: Specifications Temperature: Range: -40C to +85C Accuracy: +/-0.5C Relative Humidity: Range: 0% to 100% Accuracy: +/-3% Pressure: Range: 300mb to 1100mb Accuracy: +/-1mb You can find the data sheet for the sensor below: bme280 Sensor Specifications .pdf Download PDF • 1.59MB BME280 Commands These are some commands you can use with the BME280. i2con Enable the i2c system Purpose Turn on I2c System and update config. Syntax i2con i2coff Disable the i2c system Purpose Turn off I2c System and update config. Syntax i2coff f2c Find attached i2c devices Purpose This will scan the i2c port looking for attached i2c devices. When a new device is found it will be setup. Syntax f2c Examples > f2c < Finding I2C Devices.... < Setup BME280 temp on next free chan [26] < Setup BME280 RH on next free chan [27] < Setup BME280 Pressure on next free chan [28] Found 1 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. g2c Get register value from an i2c device Purpose This will get the value of the specified register from the specified i2c device address. Syntax g2c addr reg bytes Arguments addr The i2c devices address from the l2d command. 0 to 128 reg The register number from 0 to 256 bytes The number of bytes to expect back from the i2c device. 1 to 256. Pushers Yes Returns Nothing Examples > g2c 118 137 1 < g2c data 0[111] 1[0] final [111] Get reg no 137, one bytes from i2c address 118. Notes This can be used from the command line and in programs. l2c List active i2c devices & sensors Purpose Lists all of the active i2c devices connected to the JackBord’s i2c port. This will list all of the devices associated with each i2c address. Syntax l2c l2d List active i2c devices only Purpose Lists all of the active i2c devices connected to the JackBord’s i2c port. It only lists whole devices, not sub devices. Syntax l2d s2c Send data to i2c device register Purpose Send data to the specified register on the specified i2c device. All values are integers. Syntax s2c addr reg value Arguments addr The i2c devices address from the l2d command. 0 to 128 reg The register number from 0 to 256 value An integer value between 0 and 256. Pushers Yes Examples > s2c 118 137 23 ->/result Notes This can be used from the command line and in programs. v2c Show the status of the i2c system Purpose Displays the status of the i2c system including the number of devices connected and the i2c pins. Syntax v2c rsti2c Reset all i2c devices Purpose This will reset all of the i2c devices connected to the JackBord and remove them from the system. Syntax rsti2c Examples rsti2c Previous Next






