Wednesday, 29 January 2014

Day 26

Today I stumbled into a problem with using C for the mictocotroller. The code is supposed to loop through an stop at a specific point. I have tried to use if and else statements on their own though it didnt work very well.
if (x == "test")
{
     digitalWrite(led, HIGH);
}
else
{
    digitalWrite(led, LOW);
}
the solution was to create it as a counter, using x++ as the solution to it.

x++;
if (x %% 2)
{
     digitalWrite(led, HIGH);
}
else
{
    digitalWrite(led, LOW);
}

No comments:

Post a Comment