Skip to content

Instantly share code, notes, and snippets.

View itarozzi's full-sized avatar

Ivan Tarozzi itarozzi

View GitHub Profile
/*
Adattamento dello sketch tratto dal seguente link, per la trasmissione di valori multipli
http://www.ardumotive.com/how-to-use-xbee-modules-as-transmitter--receiver-en.html
~ Simple Arduino - xBee Transmitter sketch ~
Read an analog value from potentiometer, then convert it to PWM and finally send it through serial port to xBee.
The xBee serial module will send it to another xBee (resiver) and an Arduino will turn on (fade) an LED.
The sending message starts with '<' and closes with '>' symbol.
@itarozzi
itarozzi / gist:6c59100b75fce3cf8ba629a630107359
Last active December 18, 2017 10:07
node-red openweathermap
[{"id":"bdd761c0.cec2c","type":"openweathermap","z":"936009a3.657d78","name":"","wtype":"forecast","lon":"","lat":"","city":"Rimini","country":"IT","language":"it","x":636.0173301696777,"y":306.0104284286499,"wires":[["2e1aca67.1f3da6","66be96c9.f4e458"]]},{"id":"5cd99dad.d756c4","type":"inject","z":"936009a3.657d78","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":437.01733016967773,"y":311.01044845581055,"wires":[["bdd761c0.cec2c"]]},{"id":"2e1aca67.1f3da6","type":"debug","z":"936009a3.657d78","name":"","active":true,"console":"false","complete":"true","x":1057.0174560546875,"y":391.0104923248291,"wires":[]},{"id":"504b05b0.0d78ec","type":"json","z":"936009a3.657d78","name":"","pretty":"false","x":1058.0173473358154,"y":306.01043128967285,"wires":[["638c5f61.132a8"]]},{"id":"638c5f61.132a8","type":"file","z":"936009a3.657d78","name":"","filename":"openweather-result.json","appendNewline":true,"createDir":false,"overwriteFile":"true","x":1262.0173416137695,"y":
@itarozzi
itarozzi / nodered-servo-sg90.json
Created December 24, 2017 15:29
Pilotaggio motore servo SG90 tramite nodered e raspberrypi
[{"id":"e9f26bf2.51a1e8","type":"tab","label":"Flow 1"},{"id":"e65eb1d4.f359d","type":"rpi-gpio out","z":"e9f26bf2.51a1e8","name":"","pin":"12","set":"","level":"0","freq":"50","out":"pwm","x":529,"y":117,"wires":[]},{"id":"34a4b700.0a9fca","type":"ui_slider","z":"e9f26bf2.51a1e8","name":"","label":"slider","group":"b3066501.1aaf08","order":0,"width":"5","height":"1","passthru":true,"topic":"","min":"3","max":"11","step":"0.5","x":89,"y":80,"wires":[["c7f965b8.e7a678"]]},{"id":"6612d877.5130b8","type":"ui_text","z":"e9f26bf2.51a1e8","group":"b3066501.1aaf08","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":518,"y":190,"wires":[]},{"id":"c7f965b8.e7a678","type":"change","z":"e9f26bf2.51a1e8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":324,"y":153,"wires":[["e65eb1d4.f359d","6612d877.5130b8"]]},{"id":"1478d66e.d2a18a","type":"ui_button","z":"e9f26bf2.51a1e8"
@itarozzi
itarozzi / nodered-loop-example.json
Created December 26, 2017 14:47
Esempio di realizzazione di un loop (FOR-DO) all'interno di nodered
[{"id":"fed25495.5b2798","type":"inject","z":"8057655f.a7bd08","name":"","topic":"","payload":"5","payloadType":"num","repeat":"","crontab":"","once":false,"x":103,"y":117,"wires":[["34f34e08.bde052"]]},{"id":"57b232ee.d7d5bc","type":"function","z":"8057655f.a7bd08","name":"Loop","func":"// Loop function\n\nvar cnt = flow.get('loop_count')||0;\n\ncnt--;\n\nflow.set('loop_count', cnt);\n\nif (cnt >= 0) {\n // repeat again\n return [ null, msg ];\n}\nelse {\n // loop end\n return [ msg, null ];\n}\n\n","outputs":"2","noerr":0,"x":385,"y":132,"wires":[["3818f3b3.d2efac"],["527c1e03.1c10d"]]},{"id":"c39bdb58.03bd38","type":"debug","z":"8057655f.a7bd08","name":"","active":true,"console":"false","complete":"false","x":1038,"y":100,"wires":[]},{"id":"d1f83628.430bb8","type":"debug","z":"8057655f.a7bd08","name":"","active":true,"console":"false","complete":"false","x":774,"y":142,"wires":[]},{"id":"34f34e08.bde052","type":"change","z":"8057655f.a7bd08","name":"init","rules":[{"t":"set","p":"loop_count","p
@itarozzi
itarozzi / WifiSmartConfig.ino
Last active January 11, 2018 11:20
ESP8266/ESP32 WiFiSmartConfig
/* **************************************************************************************
* Test using WIFI SmartConfig for ESP8266/ESP32
*
* Download android app here:
* https://play.google.com/store/apps/details?id=com.cmmakerclub.iot.esptouch&hl=en
*
* TODO:
* [x] store ssid and password to flash
* [ ] try saved ssid and password and enter in SmartConfig if fails
/////////////////////////////////////////////////////////////////
// ESP32 & Xiaomi Bluetooth sensor v1.00 //
// Get the latest version of the code here: //
// http://educ8s.tv/esp32-xiaomi-hack //
/////////////////////////////////////////////////////////////////
#include "SPI.h"
#include "Adafruit_GFX.h" //https://github.com/adafruit/Adafruit-GFX-Library
#include "Adafruit_ILI9341.h" //https://github.com/adafruit/Adafruit_ILI9341
@itarozzi
itarozzi / gist:ada2b37c99099f77dcb2733d45109a58
Created May 7, 2020 13:21
udev rules for xp-pen tablet
Tested on Manjaro Linux
==========================
$ cat /etc/udev/rules.d/98-xppen.rules
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="28bd/904/0", RUN+="/bin/su root -c '/opt/Linux_Pentablet/Pentablet_Driver.sh'"
$ cat /opt/Linux_Pentablet/Pentablet_Driver.sh
#!/bin/sh
HOME=/home/ivan
@itarozzi
itarozzi / main.py
Last active January 28, 2021 09:20 — forked from CoutinhoElias/main.py
Frame
from PySide2.QtWidgets import (QApplication, QWidget, QPushButton, QMainWindow, QSizePolicy,
QFrame, QLabel, QLineEdit, QHBoxLayout, QVBoxLayout)
from PySide2.QtGui import QIcon, QFont
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtCore import (QCoreApplication, QPropertyAnimation, QDate, QDateTime, QMetaObject, QObject, QPoint, QRect, QSize, QTime, QUrl, Qt, QEvent)
import sys
@itarozzi
itarozzi / main.py
Created March 10, 2021 17:08
Styling QtQuick controls in PySide2 application
"""
A really simple PySide2 application using QtQuick and Material style
(it should work on PySide6 too)
In order to set a global theme for QtQuick you can use options as described below in the __main__.
You can override style properties in single qml files, if you want
To change the Material theme (dark, light, system) or other material properties you can use a
@itarozzi
itarozzi / main.py
Created May 26, 2021 10:08
pyside2 translation
#!/usr/bin/env python3
# This Python file uses the following encoding: utf-8
import sys
import os
from PySide2.QtCore import QLocale
from PySide2.QtGui import QGuiApplication
from PySide2.QtQml import QQmlApplicationEngine
from app_config import ConfigSerial