Skip to content

Instantly share code, notes, and snippets.

View driewe's full-sized avatar
💭
Learning Gatsby

David Riewe driewe

💭
Learning Gatsby
View GitHub Profile
/*
* Traffic lights example
*
* Red light to pin 7
* Yellow light to pin 6
* Green light to pin 5
*
* Pedestrian Red light to pin 4
* Pedestrian Green light to pin 3
* Pedestrian pushbutton pin 2 (it is connected to the GND, therefore internal PULLUP resistor must be ON)
/*
* Traffic lights example
*
* Red light to pin 7
* Yellow light to pin 6
* Green light to pin 5
*
* Arduino IDE 1.6.12
*/
/*
* Software PWM for LED control
*
* Arduino IDE 1.6.12
*/
// LED is on pin 9
int led = 9;
// System variables
byte del=0; // duty cycle
unsigned int tao = 600; // length of one cycle
/* Authors: Oliver Chen, Raad Hashim, Prashant Lalwani and Purval Sule
Autonomous Arduino 101 based 4WD Rover code.
This code drives an Arduino101 microcontroller board
using the builtin Bluetooth Low Energy (BLE) functonality
, 4 sets of motor on the SEEDstudio Skeleton Bot chassis
driven by 2 grove I2C motor control drivers.
Additional components included from SEEDstudio include:
Grove LED Socket, Green LED, Grove 80cm proximity sensor
/* Tiny Calendar
V1.1 - 09.Dec.2016
by LAGSILVA
*/
#include <Time.h> //Biblioteca com as funes de tempo e calendrio
#include <LedControl.h> //Biblioteca para o controle de LED com o MAX72XX
#include <Wire.h> //Biblioteca auxiliar para o DS1307RTC - Pinos para Arduino UNO: A4 (SDA), A5 (SCL)
#include <DS1307RTC.h> //Biblioteca para o Real Time Clock
#include <Bounce2.h> //Biblioteca para ler botao do Encoder
#include <Servo.h> //arduino library
#include <math.h> //standard c library
#define PI 3.141
Servo baseServo;
Servo shoulderServo;
Servo elbowServo;
Servo gripperServo;
#include <Servo.h> //arduino library
#include <math.h> //standard c library
#define PI 3.141
Servo baseServo;
Servo shoulderServo;
Servo elbowServo;
Servo gripperServo;
#include <Adafruit_NeoPixel.h>
#include <ESP8266WiFi.h>
#include "TimeClient.h"
#define PIN D5
long lastUpdate = millis();
long lastSecond = millis();
String hours, minutes, seconds;
int currentSecond, currentMinute, currentHour;
/*
digital input, digital output, serial output
Reads an analog input pin, maps the result to a range from 0 to 255
and uses the result to set the pulsewidth modulation (PWM) of an output pin.
Also prints the results to the serial monitor.
The circuit:
* potentiometer connected to analog pin 0.
Center pin of the potentiometer goes to the analog pin.
@driewe
driewe / 8x8 Welcome To Arduino with counter.ino
Created December 18, 2015 20:43
8x8 Welcome To Arduino with counter
// based on an orginal sketch by Arduino forum member "danigom"
// http://forum.arduino.cc/index.php?action=profile;u=188950
// I am using this to drive 8x8 LED Matrixes with the MAX7219 controller
//http://www.davidriewe.com/2015/11/expanding-on-my-experiment-with-max7219.html
//
// I am also using Timer2 to generate an interrupt every "period" seconds
// and use that to update a 7 segment display via the I2C interface.
#include <avr/pgmspace.h>
#include <LedControl.h>