Skip to content

Instantly share code, notes, and snippets.

View vongomben's full-sized avatar

vongomben

View GitHub Profile
@vongomben
vongomben / gist:ca0fa656431f49a05ee1d7e135ebdcc1
Created December 17, 2020 12:42
Query Tag Mqtt SQL lite
[{"id":"fd04a8e8.b4e6d8","type":"tab","label":"Aedes Mqtt 17 Dicembre","disabled":false,"info":""},{"id":"b0ea04d4.e7e008","type":"mqtt in","z":"fd04a8e8.b4e6d8","name":"","topic":"/ITS","qos":"2","datatype":"auto","broker":"abf1da65.1b0658","x":330,"y":160,"wires":[["9ca6ade7.6be3a"]]},{"id":"9ca6ade7.6be3a","type":"debug","z":"fd04a8e8.b4e6d8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":160,"wires":[]},{"id":"89293660.f058e8","type":"mqtt out","z":"fd04a8e8.b4e6d8","name":"","topic":"/ITS","qos":"","retain":"","broker":"abf1da65.1b0658","x":490,"y":100,"wires":[]},{"id":"38ec37e4.694968","type":"inject","z":"fd04a8e8.b4e6d8","name":"","topic":"","payload":"{\"message\":\"Ciao Ragazz*\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":40,"wires":[["89293660.f058e8"]]},{"id":"5e1e33f5.97aa7c","type":"inject","z":"fd04a8e8.b4e6d8","name":"complete json string (open)","topic":"/hello","payload":"{\"name\":\"Pin
[{"id":"7d5347d5.3b49c8","type":"comment","z":"fd04a8e8.b4e6d8","name":"capiamo se l'utente può accedere","info":"","x":450,"y":660,"wires":[]},{"id":"62478e9c.fbd76","type":"sqlite","z":"fd04a8e8.b4e6d8","mydb":"4e4abe36.17055","sqlquery":"msg.topic","sql":"","name":"user database","x":440,"y":740,"wires":[["c880155d.9512b8"]]},{"id":"f1a2fafc.6b8c38","type":"inject","z":"fd04a8e8.b4e6d8","name":"CREATE TABLE1","topic":"CREATE TABLE table1(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, tag TEXT, ACCESSO1 TEXT, ACCESSO2 TEXT, ACCESSO3 TEXT)","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"0.1","x":140,"y":700,"wires":[["62478e9c.fbd76"]]},{"id":"c880155d.9512b8","type":"debug","z":"fd04a8e8.b4e6d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":920,"wires":[]},{"id":"b788459b.65e6a8","type":"inject","z":"fd04a8e8.b4e6d8","name":"insert utente Pino Daniele","topic":"INSERT INTO table1 VALUES(1, \"Pino Daniele\",\"4
[{"id":"b0ea04d4.e7e008","type":"mqtt in","z":"fd04a8e8.b4e6d8","name":"","topic":"/ITS","qos":"2","datatype":"json","broker":"abf1da65.1b0658","x":330,"y":160,"wires":[["9ca6ade7.6be3a"]]},{"id":"9ca6ade7.6be3a","type":"debug","z":"fd04a8e8.b4e6d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":160,"wires":[]},{"id":"89293660.f058e8","type":"mqtt out","z":"fd04a8e8.b4e6d8","name":"","topic":"/ITS","qos":"","retain":"","broker":"abf1da65.1b0658","x":490,"y":100,"wires":[]},{"id":"38ec37e4.694968","type":"inject","z":"fd04a8e8.b4e6d8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":320,"y":100,"wires":[["89293660.f058e8"]]},{"id":"7e053ca4.bf93c4","type":"aedes broker","z":"fd04a8e8.b4e6d8","name":"","mqtt_port":1883,"mqtt_ws_port":"8000","cert":"","key":"","certname":"","keyname":"","dburl":"","usetls":false,"x":400,"y":40,"wires":[[]]},{"id":"abf1da65.1b0658","type":"mqtt-broker","z":"",
/* Arduino for Beginners with Grove
*
* This code is part of a course from Tech Explorations.
* For information about this course, please see
*
* https://techexplorations.com/so/grove/
*
* For information on hardware components and the wiring needed to
* run this sketch, please see the relevant lecture in the course.
*
/* Arduino for Beginners with Grove
*
* This code is part of a course from Tech Explorations.
* For information about this course, please see
*
* https://techexplorations.com/so/grove/
*
* For information on hardware components and the wiring needed to
* run this sketch, please see the relevant lecture in the course.
*
@vongomben
vongomben / mifare-condition-print.ino
Last active December 3, 2020 11:28
Mifare Casting Code into String [FN]
/**************************************************************************/
/*!
This example will wait for any ISO14443A card or tag, and
depending on the size of the UID will attempt to read from it.
If the card has a 4-byte UID it is probably a Mifare
Classic card, and the following steps are taken:
- Authenticate block 4 (the first block of Sector 1) using
the default KEYA of 0XFF 0XFF 0XFF 0XFF 0XFF 0XFF
Serial.print("value corrisponde a ");
Serial.print(value);
int j = 20 - value;
Serial.print(" j corrisponde a ");
Serial.print(j);
int x = 20 - j;
Serial.print(" x corrisponde a ");
Serial.println(x);
[{"id":"a7e5fb79.b6fca","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"3379850d.902a8a","type":"mqtt in","z":"a7e5fb79.b6fca","name":"","topic":"#","qos":"0","broker":"179e5f19.296bb9","x":270,"y":160,"wires":[["9b59d15d.6d1d28"]]},{"id":"9b59d15d.6d1d28","type":"debug","z":"a7e5fb79.b6fca","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":200,"wires":[]},{"id":"6ff9ea89.aac6e4","type":"inject","z":"a7e5fb79.b6fca","name":"inject \"open\" command","topic":"/hello","payload":"open","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":320,"y":300,"wires":[["97f6e1c5.ab547"]]},{"id":"97f6e1c5.ab547","type":"mqtt out","z":"a7e5fb79.b6fca","name":"","topic":"","qos":"","retain":"","broker":"179e5f19.296bb9","x":620,"y":320,"wires":[]},{"id":"3c363c12.80b1bc","type":"mosca in","z":"a7e5fb79.b6fca","mqtt_port":1883,"mqtt_ws_port":8080,"name":"","username":"mqtt_user","password":"mqtt_password","dburl":"","x":150,"y":60,
/* This example shows how to use MQTT on the main dev boards on the market
HOW TO USE:
under connect method, add your subscribe channels.
under messageReceived (callback method) add actions to be done when a msg is received.
to publish, call client.publish(topic,msg)
in loop take care of using non-blocking method or it will corrupt.
Alberto Perro & DG - Officine Innesto 2019
*/
#define BROKER_IP "brockerIpAddress"
#define DEV_NAME "mqttdevice"
@vongomben
vongomben / gist:1d26f7d2a27c9a9ee730d854f53482ee
Created May 15, 2018 14:51
Il codice del sensore di parcheggio
// These constants won't change. They're used to give names to the pins used:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to
const int ledverde = 10;
const int ledrosso = 11;
const int limite_1 = 150;
const int limite_2 = 300;