background image

Copyright © Parallax Inc.

 

 

Gimbal Joystick with Adapter (#27808) 

v1.2  11/13/2019  Page 5 of 9 

Spin Example Program for Propeller Board of Education 

Download and unzip the Gimbal Joystick Example Spin Code (search 27807 at 

www.parallax.com

). Open 

the program 

PropBOE_joystick_demo.spin

  with  the Propeller Tool  (a free download from 

www.parallax.com/propellertool

)

 

CON 
 

  _clkmode      = xtal1 + pll16x 
  _xinfreq      = 5_000_000 
   

OBJ 
 
  pst   : "Parallax Serial Terminal" 

  adc   : "PropBOE ADC" 
  joy   : "joystick" 
 

PUB  start | rawh, rawv 
 
  pst.start(9600) 
  joy.setup(0, 400, 500, 600, 50, -500, 500) 
  joy.setup(1, 400, 500, 600, 0, 0, 1000) 
  repeat 
    rawh := adc.in(0) 
    rawv := adc.in(1) 
    pst.str(string(1, "       Raw  Joystick", 11, 13, "Horiz:", 14, 7)) 
    pst.dec(rawh) 
    pst.str(string("     ", 14, 15)) 
    pst.dec(joy.value(0, rawh)) 
    pst.str(string(11, 13, "Vert:", 14, 7)) 
    pst.dec(rawv) 
    pst.str(string("     ", 14, 15)) 
    pst.dec(joy.value(1, rawv)) 
    pst.char(11) 

 

Load the program using the 

F10

 key, and open the Parallax Serial Terminal via the 

F12

 key. You should 

see a display that looks like this: 

 

 

 

As you move the joystick around, the values in the display will change to show its position. The 

Raw

 

values are the numbers read from the ADC. The joystick.spin  object scales the raw ADC values to 

produce the 

Joystick

  values. In this example, the horizontal values range from –500 to +500 and 

Содержание 27808

Страница 1: ...for convenient prototyping on breadboards or thru hole boards Simple soldering is required to use the optional but highly recommended adapter Features 5 k linear taper potentiometer on each axis Smoo...

Страница 2: ...B from the underside 3 Solder the 3 pin headers in place from the top of the board 4 Solder the 1 5 mm socket in place on top of the board Quick Start Guide Voltage Divider Circuit The voltage divider...

Страница 3: ...llowing products provide two sigma delta ADC channels each Propeller Backpack 28327 S2 Robot hacker port 28136 28336 In addition one can deploy an external ADC such as the MCP3202 604 00060 in conjunc...

Страница 4: ...of 2 and 3 Joystick c http learn parallax com propeller c simple devices joystick include adcDCpropab h Include adcDCpropab include simpletools h Include simpletools int main Main function pause 1000...

Страница 5: ...600 50 500 500 joy setup 1 400 500 600 0 0 1000 repeat rawh adc in 0 rawv adc in 1 pst str string 1 Raw Joystick 11 13 Horiz 14 7 pst dec rawh pst str string 14 15 pst dec joy value 0 rawh pst str str...

Страница 6: ...Spin Object The Spin object joystick spin handles the scaling of the raw joystick data transforming the measurements into values that are more useful to a given application The following graph illust...

Страница 7: ...ntal Vertical To measure each wiper position the attached microcontroller will charge that wiper s capacitor by outputting a high on the associated pin Then it will tri state the pin and let the cap d...

Страница 8: ...basicstampsoftware STAMP BS2 PBASIC 2 5 LR VAR Word UD VAR Word DO HIGH 4 PAUSE 10 RCTIME 4 1 UD HIGH 11 PAUSE 10 RCTIME 11 1 LR DEBUG HOME Vert DEC UD CLREOL CR Horiz DEC LR CLREOL PAUSE 50 LOOP Pres...

Страница 9: ...n the vertical axis Tighten to disable the return to center action Screw B Loosen to remove friction from the vertical axis Tighten to add friction Screw C Loosen to remove detents from the vertical a...

Отзывы: