Skip to content

Instantly share code, notes, and snippets.

View yeffrimic's full-sized avatar

Yeffri J. Salazar yeffrimic

View GitHub Profile
// this sketch is used for testing LoNet with Arduino
// Connect VIO to +5V
// Connect GND to Ground
// Connect RX (data into SIM808) to Digital 11
// Connect TX (data out from SIM808) to Digital 10
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
#include softwareSerial
String datosEntrantes;
softwareSerial pic(2,3) //rx,tx pines
void setup(){
Serial.begin(115200);
pic.begin(115200);
}
void loop(){
#include <SoftwareSerial.h>;
#define TX 0
#define RX 1
#define Led 2
SoftwareSerial BT(RX,TX);
void setup(){
BT.begin(9600);
}
#define segA 9
#define segB 8
#define segC 7
#define segD 6
#define segE 5
#define segF 4
#define segG 3
#define display1 2
#define display2 1
//We always have to include the library
#include "LedControl.h"
#include "DHT.h"
#define DHTPIN 2 // what digital pin we're connected to
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
import paho.mqtt.client as mqtt
# El callback para cuando el cliente reciva un Connack de respuesta del servidor.
def on_connect(client, userdata, flags, rc):
print("Conectado con el siguiente codigo "+str(rc))
#Suscribirse dentro de On_connect signidica que si perdemos la conexion
#y nos reconectamos la suscripcion se renovara.
client.subscribe(MQTT_topicSub)
# The callback for when a PUBLISH message is received from the server.
import paho.mqtt.client as mqtt
# El callback para cuando el cliente reciva un Connack de respuesta del servidor.
def on_connect(client, userdata, flags, rc):
print("Conectado con el siguiente codigo "+str(rc))
#Suscribirse dentro de On_connect signidica que si perdemos la conexion
#y nos reconectamos la suscripcion se renovara.
client.subscribe(MQTT_topicSub)
# The callback for when a PUBLISH message is received from the server.
def on_message(client, userdata, msg):
int salida1 = 10;
int salida2 = 10;
boolean cerrado=false;
boolean abierto=true;
int tiempoCerrado=5000;
void setup() {
// put your setup code here, to run once:
pinMode(salida1,OUTPUT);
pinMode(salida2,OUTPUT);
}
/*
Stepper Motor Control - one revolution
This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.
The motor should revolve one revolution in one direction, then
one revolution in the other direction.