Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import time
- import serial
- if __name__ == '__main__':
- t=str(chr(116))
- u=str(chr(117))
- retonar=str(chr(0))
- print ("Obtendo informacoes da Conexao com o Arduino\n")
- conectar = serial.Serial('COM3', 9600, timeout=1)
- retonar=conectar.readline()
- print ("Conexao Estabelecida com Sucesso!")
- print ("Status da Porta: %s", conectar.isOpen())
- print ("Arduino conectado: %s", conectar.name)
- print ("Dump da configuracao: %s", conectar)
- time.sleep(2)
- conectar.write(b't')
- time.sleep(1.5)
- retornar= conectar.read(1)
- if (retornar == 1):
- print("Teste")
- else:
- print("Nao a Resposta!")
- time.sleep(10)
- conectar.write(b'u')
- time.sleep(1.5)
- if (retornar == 1):
- print("Teste!")
- else:
- print("Nao a resposta!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement