Transmitter circuit
Receiver circuit
Programe:
int ledPin = 13;
int numChanges = 0;
int MAX_TIME = 1000;
boolean changed = false;
boolean prevReadHigh = false;
int startTime;
int finishTime;
void setup() {
pinMode(ledPin, INPUT);
Serial.begin(9600);
}
void loop()
{
finishTime = (millis() + MAX_TIME);
numChanges = 0;
changed = false;
prevReadHigh = false;
while(millis() <= finishTime)
{
if (digitalRead(ledPin) == HIGH)
{
Serial.println("high");
if (prevReadHigh != true)
{
prevReadHigh = true;
numChanges++;
}
}
else
{
Serial.println("low");
if (prevReadHigh != false)
{
prevReadHigh = false;
numChanges++;
}
}
}
Serial.println(numChanges);
delay(100);
}
Process:
1: Set up both circuits on a single bread board
2: changed the voltage to the receiver from 9 volts to 5 volts so that the arduino could handle it. (still not sure what effect this had on the project)
3: wrote programe
4: realized that the receiver receives pulses (not just one consistent voltage) and therefor had to rewrite my programe to count the pulses.
5: tried using buzzers and LED's to get a signal from the transmitter but soon after realized that the pulses are to fast for ether of them to pick it up.
6: applied a "ground" to several IC pins after realizing they were not connected.
7: ended up getting what looked like a pulse on the LED and had some variance when I moved the transmitter closer to the receiver which lead me to believe that the transmitter was actually transmitting.
8: couldn't manage to read the pulses in the arduino due to a lack of voltage which I am still unsure of.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment