| 数据搜索系统,热门电子元器件搜索 |
|
DFR0566 数据表(PDF) 13 Page - DFROBOT |
|
|
|||||||||||||||||||||||||||||
DFR0566 数据表(HTML) 13 Page - DFROBOT |
|
13 / 18 page ![]() import time from DFRobot_RaspberryPi_Expansion_Board import DFRobot_Expansion_Board_IIC as Board from DFRobot_RaspberryPi_Expansion_Board import DFRobot_Expansion_Board_Servo as Servo board = Board(1, 0x10) # Select i2c bus 1, set address to 0x10 servo = Servo(board) ''' print last operate status, users can use this variable to determine the result of a function call. ''' def print_board_status(): if board.last_operate_status == board.STA_OK: print("board status: everything ok") elif board.last_operate_status == board.STA_ERR: print("board status: unexpected error") elif board.last_operate_status == board.STA_ERR_DEVICE_NOT_DETECTED: print("board status: device not detected") elif board.last_operate_status == board.STA_ERR_PARAMETER: print("board status: parameter error") elif board.last_operate_status == board.STA_ERR_SOFT_VERSION: print("board status: unsupport board framware version") if __name__ == "__main__": while board.begin() != board.STA_OK: # Board begin and check board status print_board_status() print("board begin faild") time.sleep(2) print("board begin success") servo.begin() # servo control begin while True: print("servo move to 0") servo.move(board.ALL, 0) time.sleep(1) print("servo move to 180") servo.move(board.ALL, 180) time.sleep(1) print("part servos move to 0") servo.move(0, 0) #pwm0 #servo.move(1, 0) #pwm1 #servo.move(2, 0) #pwm2 #servo.move(3, 0) #pwm3 time.sleep(1) print("part servos move to 180") servo.move(0, 180) #pwm0 #servo.move(1, 180) #pwm1 #servo.move(2, 180) #pwm2 #servo.move(3, 180) #pwm3 time.sleep(1) |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |