Let's Make Robots!

processing to PICAXE

Byjinx

 

hi  all,

     well  while i await the return of the ardiuno am been playin around with an accl.adxl335 and a couple of servos  I came across CTC post  http://letsmakerobots.com/node/21878  thought  the that  be fun for servo's,  the processing  appears  fine  slider  work  variables in the the dispay window set to com1 all good ,  Now the picaxe code is freakin me out  AM  trying to set up serrxd cmd but just dont understand  manual2  just ain't helping this time round !  anyone have a code snippet   or even kindly explain how to  do " if i can do it"  get the incoming variables on the picaxe so i can display on the oled, am using  a PICAXE 18m2+ for this test  

               jinx

here the picaxe code i,ve got so far :

 

#picaxe 18m2

 

disconnect

symbol timeout = 1000

symbol lcd = c.1

symbol line1 = 128

symbol line2 = 192

symbol line3 = 148

symbol line4 = 212

 

hsersetup B9600_4, %00

 

init:

   disconnect

      serout lcd,N2400,(254,1)

      pause 30

      serrxd [1000],#b0

      do

 serrxd [100],(#b0,#b1,bptr)

 serout lcd,n2400,(254,line1," Y ",#b1)

 loop

 

 

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jinx's picture

 I understand the process a little better as well.

 Firstly the serial B_rate on the 18m2+ is 4800 where in the processing sketch it set to 9600  

the PICAXE code:

     #Picaxe 18m2
#No_Data
#com 1

 

symbol lcd = c.1
symbol line1 = 128
symbol line2 = 192
symbol line3 = 148
symbol line4 = 212

symbol baud_r=n2400

symbol inputval = b0
symbol inputval2 = b1
symbol servoport0   = b.4
symbol servoport1   = b.5

symbol base = w10
symbol tilt = w11

init:
    
   
      disconnect
      servo servoport0, 150
      servo servoport1, 150
      pause 30
     
  do
    serrxd (13), b0,b1,b3
  
     if inputval <> base then
      servopos servoport0, inputval
      let base = inputval
     endif
    
    if inputval2 <> tilt then
     servopos servoport1, inputval2
     let tilt = inputval2
    endif
   
    loop

    seems to work ok,

 http://www.youtube.com/watch?v=B4f_BQ1Dntk

 

         I like to thank the author of the processing sketch "was,nt clear in CtC vid " , and thanks CtC to pointing it out

                                                               Jinx

 

 

 

 

 

 

 

 

 

 

 

 

 

 

jinx's picture

Well gone back to the beginning i,ve managed to get the serial terminal to work  only at serial rate B/rate 4800 not 9600

 

'serial test

 

#Picaxe 18m2
#No_Data
#com 1


symbol lcd = c.1
symbol line1 = 128
symbol line2 = 192
symbol line3 = 148
symbol line4 = 212

'hsersetup b4800_4, %00

init:
    
      serout lcd,N2400,(254,1)
      pause 30
     
do
    serrxd b0               'Receive via download cable
    select case b0
       case "h"
         serout lcd,n2400,(254,line1,"      well am on          ")
       
       case "l"
          serout lcd,n2400,(254,line2,"     O well am off        ")
         
         case "c"
           serout lcd,N2400,(254,1)
       else
    end select
loop

 

now am gonna spend the day gettin processing to sendthe characters   instead of the terminal window wish me luck

                                                                                  Jinx.