User Tools

Site Tools


beginhere

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
beginhere [2020/10/03 21:03]
bob
beginhere [2020/10/03 21:36] (current)
bob
Line 176: Line 176:
 The links of videos are embedded inside the python code The links of videos are embedded inside the python code
  
 +  
   # one example to use python to control the moving of robot, do this,   # one example to use python to control the moving of robot, do this,
   # comment out the line "os.system ("dpcat quad2 counts") "    # comment out the line "os.system ("dpcat quad2 counts") " 
Line 188: Line 188:
   # https://www.youtube.com/watch?v=pTqB3A1N5hY   # https://www.youtube.com/watch?v=pTqB3A1N5hY
   # you will see robot keeps ouputing counts and times   # you will see robot keeps ouputing counts and times
 +  
   # to use python to control both robot and encorder   # to use python to control both robot and encorder
   # you need to do some coding   # you need to do some coding
Line 200: Line 200:
   os.system ("cat DPCore.bin > /dev/ttyUSB0") # green LED turns on   os.system ("cat DPCore.bin > /dev/ttyUSB0") # green LED turns on
   os.system ("dpdaemon -ef &") # -ef so we see error messages   os.system ("dpdaemon -ef &") # -ef so we see error messages
- 
   os.system ("dpset 4 pwm_frequency 20000") # set the motor pwm frequency   os.system ("dpset 4 pwm_frequency 20000") # set the motor pwm frequency
   os.system ("dpset 5 update_period 50") # set the quadrature decorder sampling rate   os.system ("dpset 5 update_period 50") # set the quadrature decorder sampling rate
Line 206: Line 205:
   while(1):   while(1):
      
-  os.system ("dpset 2 display 2.22222"+    os.system ("dpset 2 display 2.22222"
-  os.system ("dpset 3 display 3.33333"+    os.system ("dpset 3 display 3.33333"
-  os.system ("dpset 4 mode0 f") +    os.system ("dpset 4 mode0 f") 
-  os.system ("dpset 4 mode1 f") +    os.system ("dpset 4 mode1 f") 
-  os.system ("dpset 4 power0 50") +    os.system ("dpset 4 power0 50") 
-  os.system ("dpset 4 power1 50") +    os.system ("dpset 4 power1 50") 
-  os.system ("dpcat quad2 counts") ###  +    os.system ("dpcat quad2 counts") ###  
-  time.sleep(5) +    time.sleep(5) 
-  os.system ("dpset 4 mode0 b") +    os.system ("dpset 4 mode0 b") 
-  os.system ("dpset 4 mode1 b") +    os.system ("dpset 4 mode1 b") 
-   +    os.system ("dpset 4 mode0 r") 
-  os.system ("dpset 4 mode0 r") +    os.system ("dpset 4 mode1 r") 
-  os.system ("dpset 4 mode1 r") +    os.system ("dpset 4 power0 50") 
-  os.system ("dpset 4 power0 50") +    os.system ("dpset 4 power1 50") 
-  os.system ("dpset 4 power1 50") +    time.sleep(5) 
-  time.sleep(5) +
  
  
  
  
beginhere.1601758985.txt.gz · Last modified: 2020/10/03 21:03 by bob