Show Posts
Pages: [1]
1  Using Arduino / Sensors / IR Infrared 36khz reading random values on: March 04, 2014, 07:12:10 pm
I have a very simple setup in which my arduino board is reading IR remote signals using the Shirriff examples. My remotes seem to work as expected, except for the one I am actually trying to use. When I press any button, it returns random results. I have determine that the frequency is 36khz instead of 38khz, but that has not resolved my issue.

I have tried to receive the raw data and it looks "similar" enough, but now I am unable to send that data and have any affect on my cable box. The remote is an AT&T U-Verse remote and the cable box is an AT&T U-Verse cable box.

I have spent multiple days chasing my tail on this. Does anyone have any advice, test, or suggestions?

Thanks,
Jake
2  Using Arduino / Programming Questions / Re: AS3 to Arduino - Passing Strings on: November 26, 2012, 01:00:56 pm
This solved the problem. Do you know of a way to trace or output the data from the AS3 socket that the Arduino is reading? I want to ensure that the string I am sending is being read correctly.
3  Using Arduino / Programming Questions / AS3 to Arduino - Passing Strings on: November 15, 2012, 08:50:00 pm
I have a problem with trying to receive string data from AS3. It is being sent as a socket.writeUTFBytes. I am not sure what I am missing. In the Arduino code below, I am expecting three various strings from the serial, U, D, and motor###. This works great in the serial monitor, but not when sending anything from Flash to the serial socket. Can someone please direct me toward the right direction?

Code:
#include <stdio.h>
#include <Stepper.h>

const int pwmA = 3;
const int pwmB = 11;
const int brakeA = 9;
const int brakeB = 8;
const int dirA = 12;
const int dirB = 13;
const int steps = 200;
Stepper myStepper(steps, dirA, dirB);

int led = 6;

void setup() {
  Serial.begin(9600);
  pinMode(led, OUTPUT);
 
  myStepper.setSpeed(100);
 
  // Turn on pulse width modulation
  pinMode(pwmA, OUTPUT);
  digitalWrite(pwmA, HIGH);
  pinMode(pwmB, OUTPUT);
  digitalWrite(pwmB, HIGH);

  // Turn off the brakes
  pinMode(brakeA, OUTPUT);
  digitalWrite(brakeA, LOW);
  pinMode(brakeB, OUTPUT);
  digitalWrite(brakeB, LOW);
 
  Serial.println("OK");
}

char command[1024];
char commandBuffer[128];
int commandBufferSize = 0;

void readCommandBuffer(int bytesToRead) {
int i = 0;
char c = 0;
while (i < 128 && (i < bytesToRead || bytesToRead <= 0)) {
while (!Serial.available())
;
c = Serial.read();
if (c == '\r' || c == '\n') {
break;
}
commandBuffer[i] = c;
i++;
}
commandBufferSize = i;
}

void readCommand() {
command[0] = '\0';
readCommandBuffer(0);
if (strncmp(commandBuffer, "RCV", 3) == 0) {
commandBuffer[commandBufferSize] = '\0';
int expectedSize = atoi(commandBuffer + 4);
if (expectedSize <= 0 || expectedSize > 1024) {
return;
}
Serial.println("RDY");
int bytesRead = 0;
while (bytesRead < expectedSize) {
readCommandBuffer(expectedSize - bytesRead);
memcpy(command + bytesRead, commandBuffer, commandBufferSize);
bytesRead += commandBufferSize;
Serial.print("ACK ");
Serial.println(commandBufferSize);
}
command[bytesRead] = '\0';
} else {
memcpy(command, commandBuffer, commandBufferSize);
command[commandBufferSize] = '\0';
}     
}

void loop() {
  while(Serial.available() == 0);
 
  //readCommand();
  //Serial.println(command);
 
 
  readCommand();
  String str = String(command);
  Serial.println(str);
 
  if(str.indexOf("motor") >= 0){
    int newPosition = str.substring(5,str.length()).toInt();
    digitalWrite(pwmA, HIGH);
    digitalWrite(pwmB, HIGH);
    myStepper.step(newPosition);
    digitalWrite(pwmA, LOW);
    digitalWrite(pwmB, LOW);
  }else{
    digitalWrite(pwmA, LOW);
    digitalWrite(pwmB, LOW); 
    if(str == "U"){
      digitalWrite(led, HIGH);
    } else if(str == "D"){
      digitalWrite(led, LOW);
    }
  }
 
}

4  Community / Gigs and Collaborations / Chicago Area Freelancer on: November 12, 2012, 05:09:27 pm
I need some foundational help and guidance on a project in the Chicago area. I am combining a stepper motor, NFC module, LED lights and an infrared sensor. I have everything functioning independently, but now I need to get it all working together. My hope is to get the prototype developed into a board I can use for the first project.

Any help would be appreciated. My hope is to work with someone for 1-2 days, more if needed.

Thanks,
Jake
Pages: [1]