Skip to content

Instantly share code, notes, and snippets.

View lvidarte's full-sized avatar

Leo Vidarte lvidarte

View GitHub Profile
@lvidarte
lvidarte / wii.py
Created December 2, 2016 20:52
Wii test
import cwiid
import time
wm = cwiid.Wiimote()
wm.rpt_mode = cwiid.RPT_BTN | cwiid.RPT_ACC
buttons = {
cwiid.BTN_1: 'button 1',
cwiid.BTN_2: 'button 2',
@lvidarte
lvidarte / client.py
Created November 29, 2016 23:52
Client for Neopixels by Serial
from serial import Serial
from random import randint
import time
conn = Serial('/dev/rfcomm0', 57600)
def get_value(n):
return int(n / 2)
def set(index, r, g, b):
@lvidarte
lvidarte / main.ino
Created November 29, 2016 23:44
Neopixels by Serial
#include <Adafruit_NeoPixel.h>
#define NEOPIXEL_LEN 10
#define NEOPIXEL_PIN 13
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NEOPIXEL_LEN, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
void setup ()
{
Serial.begin(57600);
@lvidarte
lvidarte / neopixel.ino
Created November 23, 2016 17:49
Photon + NeoPixels
/*
* NeoPixel on Photon
*/
#include "neopixel/neopixel.h"
SYSTEM_MODE(AUTOMATIC);
#define PIXEL_PIN D2
#define PIXEL_COUNT 10
@lvidarte
lvidarte / main.ino
Created November 22, 2016 19:42
NeoPixels test
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
#include <Adafruit_NeoPixel.h>
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define PIN 11
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 3
@lvidarte
lvidarte / main.ino
Created November 16, 2016 15:07
DHT21 server
/**
DHTServer - ESP8266 Webserver with a DHT sensor as an input
*/
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <ESP8266WebServer.h>
#include "WiFiManager.h"
@lvidarte
lvidarte / buttons.ino
Last active October 15, 2016 22:36
Buttons controller for Minirobots Turtle
/**
* Author: Leo Vidarte <http://nerdlabs.com.ar>
*
* This is free software:
* you can redistribute it and/or modify it
* under the terms of the GPL version 3
* as published by the Free Software Foundation.
*/
const int pinBuzzer = 13;
@lvidarte
lvidarte / ui.py
Created October 11, 2016 15:09
TK Interface
# -*- coding: utf-8 -*-
import time
import Tkinter as tk
from serial import Serial
from minirobots import Turtle
try:
serial = Serial('/dev/rfcomm0', 57600)
time.sleep(1)
@lvidarte
lvidarte / server.py
Created October 11, 2016 15:06
Flask server
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import Tkinter as tk
from serial import Serial
from minirobots import Turtle
from flask import Flask, request, render_template
try:
@lvidarte
lvidarte / index.html
Created October 11, 2016 15:04
Flask template
<!doctype html>
<html>
<head>
<title>Minirobots</title>
<style type="text/css">
td { text-align: center; }
button { font-size: 3em; margin: 1em; padding: 1em; }
table { width: 100%; }
</style>
</head>