Skip to content

Instantly share code, notes, and snippets.

void debug() {
Serial.print("Servo Degree(9,10)= \t");
Serial.print(pos);
Serial.print("\tServo Degree(11,6)= \t");
Serial.print(pos2);
Serial.println();
}
import processing.serial.*;
Serial port;
int[] readings = new int[3];
void setup()
{
size(600, 600);
noStroke();
port = new Serial(this, "/dev/cu.usbmodem1411", 9600);
}
//mpu 6050 code reference http://playground.arduino.cc/Main/MPU-6050#short
#include<Wire.h>
const int MPU = 0x68; // I2C address of the MPU-6050
int16_t AcX, AcY, AcZ, Tmp, GyX, GyY, GyZ;
void setup() {
Wire.begin();
//mpu 6050 code reference http://playground.arduino.cc/Main/MPU-6050#short
#include<Wire.h>
#include <Servo.h>
const int MPU = 0x68; // I2C address of the MPU-6050
int16_t AcX, AcY, AcZ, Tmp, GyX, GyY, GyZ;
unsigned long pTime = 0;
Servo servo;
void setup() {
//mpu 6050 code reference http://playground.arduino.cc/Main/MPU-6050#short
#include<Wire.h>
#include "SPI.h"
#include "TFT_22_ILI9225.h"
#include <TFT.h>
#define TFT_RST 8
#define TFT_RS 9
#define TFT_CS 10 // SS
void debug(){
Serial.print("Fan 1 = ");
Serial.print(val1);
Serial.print("\t");
Serial.print("Fan 2 = ");
Serial.print(val2);
Serial.print("\t");
Serial.print("Case State = ");
Serial.print(caseState);
Serial.print("\t");
#include "FastLED.h"
#define NUM_LEDS 15
#define DATA_PIN 8
#define CLOCK_PIN 9
#define BUTTON_PIN 2
CRGB leds[NUM_LEDS];
int val;
int counter;
int caseState;
unsigned long pTime;
#include "ofApp.h"
ofNode base;
ofNode secondNode;
ofNode thirdNode;
ofPolyline line;
ofEasyCam cam;
ofSerial serial;
float a;
#include "ofMain.h"
#include "ofApp.h"
//========================================================================
int main( ){
ofSetupOpenGL(1280,800,OF_WINDOW); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
#ref:http://www.instructables.com/id/Interface-Arduino-to-MySQL-using-Python/?ALLSTEPS
import MySQLdb
import serial.tools.list_ports
db = MySQLdb.connect("localhost","root","toor","cycle") or die ("connection failed")
cursor = db.cursor();
ports = list(serial.tools.list_ports.comports())
for p in ports:
if "ttyACM" in p[1]: #fpr raspi
#if "Arduino" in p[1]: #for mac
arduino = serial.Serial('/dev'+p[1],9600,timeout = .1) #for raspi