I have done a lot of research as result of this topic learning everything from hex code to the International Space Station. Here is a link to my resources.
Once I was able to access the ISS-Above data stream, I knew that I could use this information for my needs Click here to see how I access the ISS-Above data stream.
I want my project to flash blue leds when the Internation Space Station flies over our location. ISS-Above "tells" PiGlow to turn on 0xB - eleventh LED or white LED when ISS is above our location. I will test for B and turn on my LEDs to blue. I can't use delay function because the Fab arduino needs to contiuosly monitor the Raspberry Pi and ISS-Above. I need to use the milli function and amchine state.
// check to see if it's time to change the state of the LED
if((ledState == HIGH) && (currentMillis - previousMillis >= OnTime))
{
if((ledState == HIGH) && (currentMillis - previousMillis >= OnTime))
{
ledState = LOW; // Turn it off
previousMillis = currentMillis; // Remember the time
digitalWrite(ledPin, ledState); // Update the actual LED
}
else if ((ledState == LOW) && (currentMillis - previousMillis >= OffTime))
{
ledState = HIGH; // turn it on
previousMillis = currentMillis; // Remember the time
digitalWrite(ledPin, ledState); // Update the actual LED
}
The final code below combines I2C Code, Machine State with Neopixels. This is a portion of the code.
void receiveEvent(int howMany) { <---- I2C code
while (0 < Wire.available()) { // loop through all but the last
unsigned char c = Wire.read(); // receive byte as a character
Serial.print(c,HEX); // print the character
if (c == 0x0B) //white
{
if((ledState == HIGH) && (currentMillis - previousMillis >= OnTime)) Machine State code
{
ledState = LOW; // Turn it off
previousMillis = currentMillis; // Remember the time
digitalWrite(ledPin, ledState); // Update the actual
for (int i=0;i
pixels.setPixelColor(i, pixels.Color(0,0,0)); // Moderately bright blue color.
}
}
else if ((ledState == LOW) && (currentMillis - previousMillis >= OffTime))
{
ledState = HIGH; // turn it on
previousMillis = currentMillis; // Remember the time
digitalWrite(ledPin, ledState); // Update the actual LED
for (int i=0;i pixels.setPixelColor(0, pixels.Color(0,0,255)); //neo pixel code make it blue pixels.show(); //neo pixel code }
Final Assembly
Videos
Exercise Files