Skip to content

Instantly share code, notes, and snippets.

View dpslwk's full-sized avatar

dps.lwk dpslwk

  • Nottingham, UK
View GitHub Profile
//*****************************************************************************
//
// very hacked together WS2812 example for the MPS432E4
// baseed on https://github.com/joewa/WS2812-LED-Driver_ChibiOS
// and some bits to come from https://github.com/hubmartin/STM32F4_WS2812B
// and http://www.martinhubacek.cz/arm/improved-stm32-ws2812b-library
//*****************************************************************************
#include <stdint.h>
#include <stdbool.h>
@dpslwk
dpslwk / LLAPLoop.py
Created April 29, 2015 12:25
Python serial loop example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#import the PySerial library and sleep from the time library
import serial
from time import sleep, time
# declare to variables, holding the com port we wish to talk to and the speed
port = '/dev/ttyAMA0'
baud = 9600
@dpslwk
dpslwk / PythonLLAPSerialin.py
Created April 9, 2015 08:47
This is a snippet of python used to read incoming LLAP messages from a serial port, is called as part of a while loop in a dedicated serial thread.
# class level varables for check incoming characters are valid LLAP
_validID = "ABCDEFGHIJKLMNOPQRSTUVWXYZ-#@?\\*"
_validData = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 !\"#$%&'()*+,-.:;<=>?@[\\\/]^_`{|}~"
def _SerialReadIncomingLLap(self):
char = self._serial.read() # should not time out but we should check anyway
self.logger.debug("tSerial: RX:{}".format(char))
if char == 'a':
@dpslwk
dpslwk / i2c_tmp100na.py
Last active December 29, 2015 08:19
B025 - RTC/EEPROM/TMP Python example for the TMP100NA Temp sensorhttp://docs.ciseco.co.uk/RET
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" B025 - RTC/EEPROM/TMP Example for the TMP100NA Temp sensor
Copyright (c) 2013 Ciseco Ltd.
Example test code by: Matt Lloyd
Orignal Temp100 Class by Adam Boardman
Which can be found at
https://github.com/adamboardman/eve-alpha-tmp100
@dpslwk
dpslwk / i2c_24lc256.py
Last active August 12, 2019 09:14
B025 - RTC/EEPROM/TMP Example For the 24LC256 EEPROM http://docs.ciseco.co.uk/RET
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" B025 - RTC/EEPROM/TMP Example For the 24LC256 EEPROM
Copyright (c) 2013 Ciseco Ltd.
Author: Matt Lloyd
Requires wiringpi2-python for i2c interface
This code is distributed in the hope that it will be useful,
@dpslwk
dpslwk / LLAPSend.py
Last active December 19, 2015 09:59
Very simple Python script to send first argument over serial Usage: ./LLAPSend.py "a--HELLO----"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import serial
import sys
import time
port = '/dev/ttyAMA0'
baud = 9600
@dpslwk
dpslwk / I2C_24LC256.ino
Created July 4, 2013 08:30
Arduino 24LC256 I2C EEPROM Test sketch
#include <Wire.h>
const int theDeviceAddress = 0x50;
void setup(void) {
Serial.begin(9600);
Wire.begin();
//power the board
pinMode(A2,OUTPUT);
digitalWrite(A2,LOW);
@dpslwk
dpslwk / TMP100.ino
Created July 4, 2013 08:28
Arduino TMP100 Test Sketch
// Display TMP100 readout to serial
// Fork Robotics 2012
//
// Set the TMP Address and Resolution here
int tmpAddress = 0x48;
int ResolutionBits = 10;
#include <Wire.h>