Skip to content

Instantly share code, notes, and snippets.

View tombrad's full-sized avatar

Tomas Bradanovic tombrad

View GitHub Profile
import serial
arduino = serial.Serial('/dev/ttyACM0', 9600)
arduino.write("L") #Mandar un comando hacia Arduino
arduino.close()
@tombrad
tombrad / enciendeled.py
Created July 29, 2017 21:28
Encender LED última versión (funciona desde la consola)
import serial
arduino = serial.Serial('/dev/ttyACM0', 9600)
arduino.write("H") #Mandar un comando hacia Arduino
@tombrad
tombrad / enciendeled.py
Created July 29, 2017 20:48
Nueva versión, si funciona anidando en un loop
import serial
arduino = serial.Serial('/dev/ttyACM0', 9600)
while True:
arduino.write("H") #Mandar un comando hacia Arduino
arduino.close() #Finalizamos la comunicacion
@tombrad
tombrad / enciendeled.py
Created July 29, 2017 20:44
Nuevo archivo para prender LED, versión 1
import serial
arduino = serial.Serial('/dev/ttyACM0', 9600)
arduino.write("H") #Mandar un comando hacia Arduino
print('LED ENCENDIDO')
arduino.close() #Finalizamos la comunicacion
@tombrad
tombrad / PHP para llamar programas Python
Created July 29, 2017 20:24
Página PHP para llamar a programas en Python (Autor Diego Torres)
<html>
<head>
<?php
if (isset($_POST['LedON']))
{
exec('sudo python /var/www/html/raspduino/enciendeled.py');
}
if (isset($_POST['LedOFF']))
{
exec('sudo python /var/www/html/raspduino/apagaled.py');
<?php
exec("sudo python enciendeled.py");
?>
import serial
arduino = serial.Serial('/dev/ttyACM0',9600)
comando="L"
arduino.write(comando)
print('LED APAGADO')
arduino.close()#FINALIZA LA COMUNICACION
import serial
arduino = serial.Serial('/dev/ttyACM0',9600)
while True:
comando="H"
arduino.write(comando)
print('LED ENCENDIDO')
arduino.close()#FINALIZA LA COMUNICACION
import serial
arduino = serial.Serial('/dev/ttyACM0',9600)
while True:
comando = raw_input('Introduce un comando: ')
arduino.write(comando)
if comando == 'H':
print('LED ENCENDIDO')
elif comando == 'L':
@tombrad
tombrad / gist:6188444
Last active March 22, 2022 18:33
My public GPG key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEYi64TRYJKwYBBAHaRw8BAQdAvxSLwojlecR+pEe8oEd+jnoqLqifnp7TX2Hj
gZDYnk+0JVRvbWFzIEJyYWRhbm92aWMgPHRvbWJyYWQyQGdtYWlsLmNvbT6ImgQT
FgoAQhYhBNhzBG0vkYcgkjjPP+mOQtSh7d8/BQJiLrhNAhsDBQkDwxUzBQsJCAcC
AyICAQYVCgkICwIEFgIDAQIeBwIXgAAKCRDpjkLUoe3fP4wuAP9RGBMSZAWCPQpR
NxqCVadL9GrLytPx9f7i2KE05A0a0wEA33EKlbFaaFN56frpFpRhOl6ltuAiDKBi
+jCwjo2Gsg+4OARiLrhNEgorBgEEAZdVAQUBAQdA5P5bwvxr45+hPLgcRCwLMeTK
+/JE2dsxW2ly3X+ZRCgDAQgHiH4EGBYKACYWIQTYcwRtL5GHIJI4zz/pjkLUoe3f
PwUCYi64TQIbDAUJA8MVMwAKCRDpjkLUoe3fP2ydAP9DqJ8ZnHRoWXoaGqcGk4rC