Skip to content

Instantly share code, notes, and snippets.

View Lauszus's full-sized avatar

Kristian Sloth Lauszus Lauszus

View GitHub Profile
@Lauszus
Lauszus / Balanduino wdt.diff
Last active August 29, 2015 14:05
Balanduino dev
diff --git a/Firmware/Balanduino/Balanduino.h b/Firmware/Balanduino/Balanduino.h
index 338024d..45039f1 100644
--- a/Firmware/Balanduino/Balanduino.h
+++ b/Firmware/Balanduino/Balanduino.h
@@ -189,6 +189,12 @@ uint32_t spekConnectedTimer; // Timer used to check if the connection is dropped
#define RC_CHAN_AUX4 7
#endif
+uint8_t resetFlags __attribute__ ((section(".noinit"))); // Source: https://code.google.com/p/optiboot/issues/attachmentText?id=66&aid=660004000&name=resetFlags_appCode.cpp
+void resetFlagsInit(void) __attribute__ ((naked)) __attribute__ ((section (".init0")));
@Lauszus
Lauszus / crc32.diff
Last active August 29, 2015 14:06
PS4 dev
diff --git a/PS4BT.h b/PS4BT.h
index 3c0aae1..b85db8c 100644
--- a/PS4BT.h
+++ b/PS4BT.h
@@ -21,6 +21,53 @@
#include "BTHID.h"
#include "PS4Parser.h"
+/*
+const uint32_t crc32_table[] PROGMEM = {
#if 0 // Right
#define PWM 9
#define DIR 8
#define PIN_REG COM1A1
#define PWM_REG OCR1A
#else // Left
#define PWM 10
#define DIR 12
#include <SPP.h>
USB Usb;
BTD Btd(&Usb);
SPP SerialBT(&Btd);
char val[3];
int pin1 = 22;
int pin2 = 24;
int pin3 = 26;
@Lauszus
Lauszus / PWM test.cpp
Last active October 13, 2015 21:48
Help for Norbert Gauci
#define PWM_FREQUENCY 20000 // The motor driver can handle a pwm frequency up to 20kHz
#define PWMVALUE F_CPU/PWM_FREQUENCY/2 // Frequency is given by F_CPU/(2*N*ICR) - where N is the prescaler, we use no prescaling so frequency is given by F_CPU/(2*ICR) - ICR = F_CPU/PWM_FREQUENCY/2
const uint8_t direction1 = 9;
const uint8_t direction2 = 10;
const uint8_t pwm1 = 11;
const uint8_t pwm2 = 12;
void setup() {
Serial.begin(115200);
@Lauszus
Lauszus / Robocup
Last active December 11, 2015 15:48
Robocup
lineDist = 0.2
irDist = 0.25
gateDist = 0.35
gateLength = 0.55
gateFoundDist = 0.2
%%%%%%%%%%%%% Husk at ændre!!!!
whiteLineValue = 0.70
%%%%%%%%%%%%%
@Lauszus
Lauszus / gist:4722886
Last active December 12, 2015 05:38
Help for Jay Subramaniam
/*
Example sketch for the RFCOMM/SPP Bluetooth library - developed by Kristian Lauszus
For more information visit my blog: http://blog.tkjelectronics.dk/ or
send me an e-mail: kristianl@tkjelectronics.com
*/
#include <Adafruit_MAX31855.h>
#include <SPP.h>
USB Usb;
BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so
@Lauszus
Lauszus / Inquiry.java
Last active December 18, 2015 01:59
Java native Bluetooth
package com.tkjelectronics.balanduinoapp;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import javax.bluetooth.DiscoveryAgent;
import javax.bluetooth.LocalDevice;
import javax.microedition.io.StreamConnection;
// Define these variables
int16_t accY;
int16_t accZ;
int16_t gyroX;
unsigned long timer;
// Put this in your setup()
Wire.begin();
i2cWrite(0x6B,0x00); // Disable sleep mode
if(i2cRead(0x75,1)[0] != 0x68) { // Read "WHO_AM_I" register
@Lauszus
Lauszus / Latex.bash
Last active January 21, 2016 21:50
Calculate "normalpages" of Latex report
$ detex Report.tex | echo "scale=3; `wc -m`/2400" | bc -l
$ detex Report.tex | tr -d ' \t\r\n' | echo "scale=3; `wc -m`/2200" | bc -l