Skip to content

Instantly share code, notes, and snippets.

View todocono's full-sized avatar
🤖
Flow?

Rodolfo todocono

🤖
Flow?
View GitHub Profile
// Processing.js example sketch
int fontsize = 24;
void setup() {
size(200, 200);
stroke(0);
fill(0);
textFont(createFont("Arial",fontsize));
noLoop();
@todocono
todocono / test.ino
Last active September 8, 2016 13:30
//this is a test of a soft
//that will never be published
void setup(){
algo wrong here
println("this is correct text");
println("this is correct text with syntax error")
}
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos=0; // variable to store the servo position
int URPWM=3; // PWM Output 0-25000us,every 50us represent 1cm
int URTRIG=5; // PWM trigger pin
boolean up=true; // create a boolean variable
unsigned long time; // create a time variable
unsigned long urmTimer = 0; // timer for managing the sensor reading flash rate
// Code example for Animatronics class - NYU Shanghai 2016
// See class details at http://ima.nyu.sh/animatronics
// Hardware part required: https://www.dfrobot.com/index.php?route=product/product&product_id=91
// Hardware part required: WiiChuck
// Library required hosted at https://github.com/todbot/wiichuck_adapter/tree/master/firmware/WiichuckDemo
// Instructions at http://todbot.com/blog/2008/02/18/wiichuck-wii-nunchuck-adapter-available/
// Tutorial at http://hacknmod.com/hack/how-to-cheap-accelerometer-using-wii-nunchuck/
@todocono
todocono / mic_servo.pde
Created November 29, 2016 05:49
This sketch works with ServoFirmata running on Arduino
import processing.serial.*;
import cc.arduino.*;
import ddf.minim.*;
Arduino arduino;
Minim minim;
AudioInput in;
color red;
color green;
int speedPin_M1 = 5; //M1 Speed Control
int speedPin_M2 = 6; //M2 Speed Control
int directionPin_M1 = 4; //M1 Direction Control
int directionPin_M2 = 7; //M1 Direction Control
void setup() {
}
void loop() {
carAdvance(100, 100);
@todocono
todocono / LDR-example.ino
Last active February 15, 2017 03:15
LDR example for DFRobot Arduino
const int speedPin_M1 = 5; //M1 Speed Control
const int speedPin_M2 = 6; //M2 Speed Control
const int directionPin_M1 = 4; //M1 Direction Control
const int directionPin_M2 = 7; //M1 Direction Control
const int LDR = A0; // Analog input pin that the potentiometer is attached to
int speedMotors = 0;
const int slow = 50;
const int fast =255;
#define DEBUG
const int speedPin_M1 = 5; //M1 Speed Control
const int speedPin_M2 = 6; //M2 Speed Control
const int directionPin_M1 = 4; //M1 Direction Control
const int directionPin_M2 = 7; //M1 Direction Control
const int LDR0 = A0; // LDR sensor to GND and 1k to 1k resistor
const int LDR1 = A1; // LDR sensor to GND and 1k to 1k resistor
const int slow = 30;
const int fast = 120;
#define DEBUG
const int speedPin_M1 = 5; //M1 Speed Control
const int speedPin_M2 = 6; //M2 Speed Control
const int directionPin_M1 = 4; //M1 Direction Control
const int directionPin_M2 = 7; //M1 Direction Control
const int LDR0 = A0; // LDR sensor to GND and 1k to 1k resistor
const int LDR1 = A1; // LDR sensor to GND and 1k to 1k resistor
const int slow = 30;
#define DEBUG
#include <PID_v1.h>
//Define Variables we’ll be connecting to
double Setpoint, Input, Output;
//Specify the links and initial tuning parameters
PID myPID(&Input, &Output, &Setpoint, 5, 0, 0.5, REVERSE);
const int speedPin_M1 = 5; //M1 Speed Control
const int speedPin_M2 = 6; //M2 Speed Control
const int directionPin_M1 = 4; //M1 Direction Control