View gist:7e02a17652d8035c3f4b3a098d38e625
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DataBase] | |
Driver = SQL Server | |
Server = DESKTOP-0HHEA1Q\SQLEXPRESS | |
Database = testDB | |
UID = python | |
PWD = admin2 |
View sql01.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyodbc | |
import time | |
import sys | |
import os | |
from datetime import datetime | |
from configparser import ConfigParser | |
dummyVar = 1 | |
va = 12 | |
vc = "Texto" |
View pyserial-matplotlib.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#String json_data = "{\"Sesor_id\":\"3E24R\",\"Value\":" + (String)randNumber + "}"; | |
import serial, time, json | |
import matplotlib.pyplot as plt | |
import numpy as np | |
hw_sensor = serial.Serial(port='COM4', baudrate=115200, timeout=1, write_timeout=1) | |
fig, ax = plt.subplots() | |
t = np.linspace(0,20,21) |
View arduino-python-serial.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long randNumber; | |
String inputString; | |
void setup(){ | |
Serial.begin(115200); | |
randomSeed(analogRead(0)); | |
} | |
void loop(){ | |
delay(100); |
View python-serial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#String json_data = "{\"Sesor_id\":\"3E24R\",\"Value\":" + (String)randNumber + "}"; | |
import serial, time, json | |
hw_sensor = serial.Serial(port='COM4', baudrate=115200, timeout=1, write_timeout=1) | |
if __name__ == '__main__': | |
while True: | |
hw_sensor.write('getValue'.encode('utf-8')) | |
time.sleep(1) |
View matplotlib-py3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import time | |
f=10 | |
T=1/f | |
t = np.linspace(0,5*T,300) | |
diff=t[1]-t[0] |
View matplotlib-py1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import math | |
x = np.linspace(0, 10, 5000) | |
fig, ax = plt.subplots() # Crea la figura y los ejes. | |
ax.plot(x, x*x) # Grafica una funcion cuadratica | |
plt.show() # Llama a la grafica para que se muestre. |
View servo.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Servo.h> | |
#include <NewPing.h> | |
#define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor. | |
#define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor. | |
#define MAX_DISTANCE 200// Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm. | |
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance. | |
Servo myservo; // create servo object to control a servo |
View Sensor.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <NewPing.h> | |
#include <Servo.h> | |
#define TRIGGER_PIN 13 | |
#define ECHO_PIN 12 | |
#define MAX_DISTANCE 50 | |
#define TimeDelayServo 200 | |
int pos; //Position Servo |
View Buzzer.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PinBuzzer 7 | |
#define SoundTime 2000 | |
#define PinSignal 8 | |
void setup() { | |
pinMode(PinBuzzer, OUTPUT); | |
pinMode(PinSignal, INPUT); | |
} | |
void loop() { |
NewerOlder