Skip to content

Instantly share code, notes, and snippets.

@pingud98
pingud98 / Miniarmcablibration.pde
Created February 27, 2014 23:33
Robot arm manual control for processing
import cc.arduino.*;
import processing.serial.*;
Arduino arduino;
int servo1Pin = 9; // Control pin for servo motor
int servo2Pin = 10; // Control pin for servo motor
int servo3Pin = 11; // Control pin for servo motor
int penposn;
void setup(){
@pingud98
pingud98 / gcodemake.pde
Created January 27, 2015 23:43
Mr Beam raster scan script for JPG to Gcode conversion
/**
* Convert a JPG image to gcode for Mr Beam
* To use, put the .jpg you want to use in the /data folder of your sketch and adjust the canvas size(x,y) to suit the image,
* Use the feedrate, laserfloor and lasermax variables to determine how fast and how hard it burns.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@pingud98
pingud98 / TC74readout
Created March 18, 2015 19:16
TC74 I2C temp sensor and arduino
#include <Wire.h>
//wire library
/*
Sourced from
http://www.instructables.com/id/Thermostat-Microcontroller-with-an-Arduino-and-a-T/step4/TC74-Arduino-code/
and modified a bit!
*/
//works better when you connect SDA and SCLK
@pingud98
pingud98 / Piinterruptread
Created March 26, 2015 20:36
Cosmic Pi - Port read in on interrupt
//insert gpl code headers here
//macro cycle:
//setup: intitalise, read all devices and send, wait for gps acquisition
//loop: null
//interrupt:
//1)read in ADC's (direct port sampling)
//2)read out GPS timestamp (TIMEMARK) and position (UART or SPI)
//3)read out extra data (temp, pressure, humidity) (I2C)
//3.1)maybe read some more out of the adc's (3 samples?) direct port sampling, cycle clock
//4)apply high level trigger (threshold?) test.
@pingud98
pingud98 / cosmicdatamaker
Created June 19, 2015 20:23
Cosmic Pi data generator script
/*
DigitalReadSerial
Reads a digital input on pin 2, prints the result to the serial monitor
This example code is in the public domain.
*/
// digital pin 2 has a pushbutton attached to it. Give it a name:
//int pushButton = 2;
@pingud98
pingud98 / cosmicdatajson
Last active October 2, 2015 20:44
Json format data generator for cosmic Pi
/*
DigitalReadSerial
Reads a digital input on pin 2, prints the result to the serial monitor
This example code is in the public domain.
*/
// digital pin 2 has a pushbutton attached to it. Give it a name:
//int pushButton = 2;
@pingud98
pingud98 / gist:2f859cd9a8e740ceec1d
Created June 20, 2015 14:18
Cosmic Pi 10DOF IMU + Temp/Humidity combined readout
// HTU21D-F is on Arduino Due I2C Bus 2, followed the guidance on forum.arduino.cc/index.php?topic=216359.0 to make it work
//modifications to HTU21DF.h and .cpp not included in this file. Also commented out delay.h as it's AVR not ARM.
#include <Adafruit_Sensor.h>
#include <Adafruit_L3GD20_U.h>
#include <Adafruit_BMP085_U.h>
#include <Adafruit_LSM303_U.h>
#include <Adafruit_10DOF.h>
@pingud98
pingud98 / piread
Last active August 29, 2015 14:23
Cosmic Pi readout version 1
#include <Adafruit_GPS.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_L3GD20_U.h>
#include <Adafruit_BMP085_U.h>
#include <Adafruit_LSM303_U.h>
#include <Adafruit_10DOF.h>
#include <Adafruit_HTU21DF.h>
#include <Wire.h>
#define mySerial Serial1
@pingud98
pingud98 / Fast ADC CH6 CH7
Last active September 12, 2019 19:34
Arduino Due Fast ADC script
unsigned long start_time;
unsigned long stop_time;
unsigned long values[2000];
void setup() {
Serial.begin(115200);
REG_ADC_MR = 0x10380180; // change from 10380200 to 10380180, 1 is the PREESCALER and 8 means FREERUN
ADC -> ADC_CHER = 0x03; // enable ADC on pin A0
}
@pingud98
pingud98 / radtestoutput.ino
Created July 21, 2015 09:30
Cyclic ADC sampling for Arduino Mega
int sensorPin0 = A0; // select the input pin for the potentiometer
int sensorPin1 = A1; // select the input pin for the potentiometer
int sensorPin2 = A2; // select the input pin for the potentiometer
int sensorPin3 = A3; // select the input pin for the potentiometer
int sensorPin4 = A4; // select the input pin for the potentiometer
int sensorPin5 = A5; // select the input pin for the potentiometer
int sensorPin6= A6; // select the input pin for the potentiometer
int sensorPin7 = A7; // select the input pin for the potentiometer
int sensorPin8 = A8; // select the input pin for the potentiometer
int sensorPin9 = A9; // select the input pin for the potentiometer