Navigation Menu+

eTextiles and Haptic Feedback

Posted on Jun 4, 2016 by in Events, Projects |

[EXCERPT_SIZE=”15″]
Link to presentation

Supplies:

  • Nylon Fabric
  • slightly stretchy knit fabric for cover (this is an aesthetic decision, but should be able to stretch with functional layer)
  • non-conductive thread
  • conductive thread
  • conductive yarn with high resistance
  • (2) lilypad Simblee
  • 5v FTDI programmer
  • 3 vibrating disc motors

 

hapticReceive Code:

// To use the SimbleeForMobile library, you must include this file at the top
// of your sketch. **DO NOT** include the SimbleeBLE.h file, as it will cause
// the library to silently break.
#include “SimbleeCOM.h”

const int led = 13; // The Simblee BOB (WRL-13632) has an LED on pin 2.
int ledState = LOW;

// Every draw command returns a uint8_t result which is the object id that was
// created. If you wish to change the object later, you’ll need this value,
// and if you want to catch an event created by an object, you’ll need it
// there, too. Make sure you create these id variables outside of any function,
// as you’ll need to refer to them in many other functions.

uint8_t btnID;
uint8_t switchID;
uint8_t sliderID;
uint8_t sliderTextID;

void setup()
{
Serial.begin(9600);
SimbleeCOM.begin();
}

void loop()
{

}

// ui() is a SimbleeForMobile specific function which handles the specification
// of the GUI on the mobile device the Simblee connects to.
void SimbleeCOM_onReceive(unsigned int esn, const char *payload, int len, int rssi)
{

analogWrite(uint32_t (9), uint32_t (payload[0]));
delay(150);
analogWrite(uint32_t (9), uint32_t (0));
delay(1);
analogWrite(uint32_t (11), uint32_t (payload[0]));
delay(150);
analogWrite(uint32_t (11), uint32_t (0));
delay(1);
analogWrite(uint32_t (15), uint32_t (payload[0]));
delay(150);
analogWrite(uint32_t (15), uint32_t (0));
delay(1000);

}

 

hapticSend Code:

#include “SimbleeCOM.h”

char payload[] = {1};

void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
SimbleeCOM.begin();
}

void loop() {
int btn = analogRead(3);

btn = map(btn, 0, 255, 255, 80);

Serial.print(btn);
Serial.print(“\n”);
payload[0] = btn;
SimbleeCOM.send(payload, sizeof(payload));

delay(100);
}