Skip to content

Instantly share code, notes, and snippets.

View vongomben's full-sized avatar

vongomben

View GitHub Profile
#include "FastLED.h"
// How many leds in your strip?
#define NUM_LEDS 8
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 3
// #define CLOCK_PIN 13
#include "FastLED.h"
// How many leds in your strip?
#define NUM_LEDS 8
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 3
// #define CLOCK_PIN 13
#include "FastLED.h"
// How many leds in your strip?
#define NUM_LEDS 8
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 3
// #define CLOCK_PIN 13
/*******************************************************************
An example of bot that receives commands and turns on and off
an LED.
* *
written by Giacarlo Bacchio (Gianbacchio on Github)
adapted by Brian Lough
*******************************************************************/
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>
@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;
/* 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"
[{"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,
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);
@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
/* 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.
*