#!/usr/bin/python3 # -*- coding:utf-8 -*- import sys import os FILE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(FILE_DIR,"..","..","clientIRC")) import arduinobot if __name__ == "__main__": arduinobot.run( nickname="othersbot", channel="#others", serial_port="/dev/ttyACM0", protocol_file=os.path.join(FILE_DIR,"..","..","protocole.h"), protocol_prefixe="QO_")
#!/usr/bin/python3 # -*- coding:utf-8 -*- import sys import os FILE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(FILE_DIR, "..", "..", "clientIRC")) import arduinobot if __name__ == "__main__": arduinobot.run( nickname="petit_robot", # nom du bot channel="#actionsmini", # canal sur lequel se connecter serial_port="/dev/ttyACM0", # port de l'arduino protocol_file=os.path.join(FILE_DIR, "..", "driver", "protocole.h"), # où trouver le protocole.h protocol_prefixe="Q_", ) # préfix des commandes dans le protocole
def cmd_testasserv_show(self, **kwargs): hold(True) """t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t) c = cos(2*pi*t) plot(t, s, linewidth=1.0) plot(t, c, linewidth=1.0) xlabel('time (s)') ylabel('voltage (mV)') title('About as simple as it gets, folks') """ plot(self.t, self.x, linewidth=1.0) plot(self.t, self.v, linewidth=1.0) plot(self.t, self.pwm, linewidth=1.0) xlabel('time (s)') ylabel('') title('title') grid(True) show() if __name__ == "__main__": arduinobot.run( bot_class=DebugBot, nickname="asservbot", channel="#testasserv", serial_port="/dev/ttyACM0", protocol_file=os.path.join(FILE_DIR,"..","..","protocole.h"), protocol_prefixe="QTEST_")
#!/usr/bin/python3 # -*- coding:utf-8 -*- import sys import os FILE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(FILE_DIR,"..","..","clientIRC")) import arduinobot from arduinobot import * if __name__ == "__main__": arduinobot.run( nickname="asservgrosbot", channel=CANAL_BIG_ASSERV, serial_port="/dev/ttyAsserv", protocol_file=os.path.join(FILE_DIR,"..","..","protocole.h"), protocol_prefixe="QA_")
#!/usr/bin/python3 # -*- coding:utf-8 -*- import sys import os FILE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(FILE_DIR,"..","..","clientIRC")) import arduinobot if __name__ == "__main__": arduinobot.run( nickname="asservbot", channel="asserv", serial_port="/dev/ttyACM1", protocol_file=os.path.join(FILE_DIR,"..","..","protocole.h"), protocol_prefixe="QA_")
import pygame as pg from pygame.locals import * from pygame.color import * pg.init() screen = pg.display.set_mode((600, 400)) clock = pg.time.Clock() if __name__ == "__main__": bot = arduinobot.run( nickname="ledsbot", channel="#leds", serial_port="/dev/ttyACM0", protocol_file=os.path.join(FILE_DIR,"..","driver","protocol.h"), protocol_prefixe="Q_", blocking=False ) allume = getattr(bot, "cmd_leds_allume") eteindre = getattr(bot, "cmd_leds_eteindre") while 1: screen.fill(THECOLORS["white"]) for event in pg.event.get(): if event.type == QUIT: break elif event.type == KEYDOWN: if event.key == K_ESCAPE: