Program Speech recognition +  Light  Control

Hello..... ;D
"Sa wat Dee"

I come form thailand
My English is not good :stuck_out_tongue:
This is my project

Computer => Arduino => Relay => Lighting Control

Program
Voice Flux Pro = Program Speech recognition

Hardware

  • Freeduino
  • Relay shield
  • light bulb
  • computer

Vdo

Freeduino + Relay shield

more detail (Thai language)

Arduino

// Relay digital pin 7,4
int relayOne = 4;
int relayTwo = 7;

void setup()   {   

  Serial.begin(9600);
  pinMode(relayOne, OUTPUT);  
  pinMode(relayTwo, OUTPUT);   
  
}

void loop()                     
{
  
  char c;
  
  if (Serial.available()) 
  {
    c = Serial.read();
    if(c == 'a'){digitalWrite(relayOne, HIGH);}
    if(c == 's'){digitalWrite(relayOne, LOW);}
    
    if(c == 'z'){digitalWrite(relayTwo, HIGH);}
    if(c == 'x'){digitalWrite(relayTwo, LOW);}
   }
  
}

Processing

import processing.serial.*;

Serial myPort;  
      

void setup() 
{
 
  String portName = Serial.list()[0];
  myPort = new Serial(this, portName, 9600);
}

void draw() {
  background(255);
  if(keyPressed) {
     if(key >= 'A' && key <= 'z') {
       if(key == 'a') myPort.write('a');             
       if(key == 's') myPort.write('s');           
     }
  }
      
}