Skip to content

Instantly share code, notes, and snippets.

View dyadica's full-sized avatar

dyadica

View GitHub Profile
int sensorPin = A0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
int sensorReading = analogRead(sensorPin);
@dyadica
dyadica / TTSActivity.java
Created September 25, 2015 23:19
Simple and basic Android TTS all ready to be turned into a unity plugin
package uk.co.dyadica.ttsbasic;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.speech.RecognizerIntent;
import android.speech.tts.TextToSpeech;
import android.speech.tts.UtteranceProgressListener;
@dyadica
dyadica / CapBreakoutExample
Last active August 29, 2015 14:24
Example code for the IOST Capacitive Sensing Library breakout
#include <CapacitiveSensor.h>
// Initialise all of our cap sensors. Each shares the
// 12 pin.
CapacitiveSensor caps[] =
{
CapacitiveSensor(12,2),
CapacitiveSensor(12,3),
CapacitiveSensor(12,4),
@dyadica
dyadica / Final_SimpleStepActivity.java
Last active July 26, 2023 11:43
A simple pedometer script for Android which makes use of dedicated low-power step detecting chips
package dyadica.co.uk.simplestepcount;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Build;
@dyadica
dyadica / plugin-build.gradle
Created May 3, 2015 16:09
Simple gradle file that can be used to create both .jar and .aar compiles when authoring Android plugins for Unity3D. Simply cut and paste replace the contents of the build.gradle within the app module and update the archivesBaseName property to reflect the name of your plugin.
apply plugin: "com.android.library"
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 12
targetSdkVersion 22
@dyadica
dyadica / PlayerController.cs
Created October 20, 2014 18:27
A Unity MonoBehaviour that can be applied to a GameObject to provide simple turn on the spot joystick style player movement.
using UnityEngine;
using System.Collections;
[RequireComponent (typeof(CharacterController))]
public class PlayerController : MonoBehaviour
{
/// <summary>
/// The players character controller
/// </summary>
private CharacterController controller;
@dyadica
dyadica / SimpleLowPassFilter.cs
Last active August 29, 2015 14:07
A Unity MonoBehaviour implimentation of the Low Pass Filter as originally described by Thom Nichols
using UnityEngine;
using System.Collections;
public class SimpleLowPassFilter : MonoBehaviour
{
// time smoothing constant for low-pass filter 0 ≤ alpha ≤ 1
// a smaller value basically means more smoothing.
public float ALPHA = 0.15f;
@dyadica
dyadica / SimpleKalmanFilter.cs
Last active April 26, 2018 09:06
A Unity MonoBehaviour implimentation of my Very Simple Kalman in C# posting
using UnityEngine;
using System.Collections;
public class SimpleKalmanFilter : MonoBehaviour
{
public double Q = 0.000001;
public double R = 0.01;
public double P = 1, X = 0, K;
void Start()
@dyadica
dyadica / SpeechManager.cs
Last active August 29, 2015 14:02
An updated version of the SpeechManager class that uses the Kinect 1.8 SDK. An example of the class in action within a WinForm App can be found via my github account
// <copyright file="SpeechManager.cs" company="dyadica.co.uk">
// Copyright (c) 2010, 2014 All Right Reserved, http://www.dyadica.co.uk
// This source is subject to the dyadica.co.uk Permissive License.
// Please see the http://www.dyadica.co.uk/permissive-license file for more information.
// All other rights reserved.
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A