Sole Searching

Reinventing the pedestrian experience.

Work in progress10,390
Sole Searching

Things used in this project

Hardware components

Zippered shorts
×1
Basic sewing materials (needle, thread, and scissors)
×1
Shoe(s)
×1
Arduino Micro
Arduino Micro
×1
Bluetooth Mate Silver
×1
LCD Display
×1
Power Rail (removable from most standard breadboards)
×1
Arduino Battery Adapter
×1
9V battery (generic)
9V battery (generic)
×1
Wires
×17
Solder (and necessary tools/accessories)
×1
Rubber Heat Shrink (and heat gun)
×10
Electrical Tape (optional)
×1

Story

Read more

Code

bluetooth_stuff.cpp

C/C++
bluetooth_stuff.cpp
#include <Regexp.h>

/*
  Example Bluetooth Serial Passthrough Sketch
 by: Jim Lindblom
 SparkFun Electronics
 date: February 26,2013
 license: Public domain

 This example sketch converts an RN-42 bluetooth module to
 communicate at 9600 bps (from 115200), and passes any serial
 data between Serial Monitor and bluetooth module.
 */
#include <SoftwareSerial.h>  
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,7,6);

int bluetoothTx = 2;  // TX-O pin of bluetooth mate, Arduino D2
int bluetoothRx = 3;  // RX-I pin of bluetooth mate, Arduino D3
unsigned int i = 0;
char buf[200];
  
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
  Serial.begin(9600);  // Begin the serial monitor at 9600bps

  bluetooth.begin(115200);  // The Bluetooth Mate defaults to 115200bps
  bluetooth.print("$");  // Print three times individually
  bluetooth.print("$");
  bluetooth.print("$");  // Enter command mode
  delay(100);  // Short delay, wait for the Mate to send back CMD
  bluetooth.println("U,9600,N");  // Temporarily Change the baudrate to 9600, no parity
  // 115200 can be too fast at times for NewSoftSerial to relay the data reliably
  bluetooth.begin(9600);  // Start bluetooth serial at 9600
  lcd.begin(16, 2);
  lcd.clear();
  lcd.print("hello, world!");
  for (int j=0;j<200;j++){
    buf[j]='\0';
  }
}

void loop()
{
  MatchState ms;
  if(bluetooth.available())  // If the bluetooth sent any characters
  {
    // Send any characters the bluetooth prints to the serial monitor
    char str = (char)bluetooth.read();
    buf[i] = str;
    i++;
    if (i==199) i=0;
    Serial.print(buf);  
    
  } else {
    ms.Target(buf,0);
    char res = ms.Match(".*,(%a+)");
    if (res==REGEXP_MATCHED) {
      lcd.clear();
      lcd.print(ms.GetCapture(buf,0));
    }
  }
  if(Serial.available())  // If stuff was typed in the serial monitor
  {
    // Send any characters the Serial monitor prints to the bluetooth
    bluetooth.print((char)Serial.read());
  }
  // and loop forever and ever!
}

Credits

Clare Lin

Clare Lin

5 projects • 1 follower
I enjoy reading fiction, playing music and games, and consuming dark chocolate and jasmine green milk tea, though generally not all at the same time.
Maxwell N Rutman

Maxwell N Rutman

4 projects • 2 followers
Herrrrrrrro World
Andrew Cornelis

Andrew Cornelis

4 projects • 2 followers
Oren Berkowitz

Oren Berkowitz

4 projects • 3 followers
Zoe Beba

Zoe Beba

4 projects • 2 followers

Comments