starting the Windows media player from the UNO?

Is it possible to run the Windows Media Player from the UNO-board, and shut the player down again?

If yes......

How is it done...?

Regards
Brian Hansen
Denmark

Gobetwino? Gadgets og teknologi | Dansk Tech Blog - Mikmo

Bigger Smaller Reset Quote Modify Remove


I thank you very much for the link.

I had some big trouble to make it work with windows 7. But after changing to XP it is working fine.

By the way, are you danish? (god to now for later comunication)

Brian

Could you tell me what problems you had with GoBetwino and windows 7.

I'm woking on an update.

And yes i am danish :slight_smile:

MikMo / Mikael

Øh..så skifter jeg lige til DK.

Det er mig der har lavet en bommert mht. windows7. ....noget med at vælge de rigtige ikoner at trykke på, måske gik det hele lidt for skærkt da jeg skulle installere på W7. Programmet kører lige nu også på min Windows7, indtil videre uden problemer.
Hvis jeg støder på nogle "bugs" lover jeg at sende dem til dig.

Vh
Brian

Hej Mikael

Jeg udnytter at jeg har "fanget" dig, til lige at spørge om en sidste ting. Håber du vil hjælpe mig...igen.

Når jeg sender Serial.println til dit program, får gobetwino koden mange gange, så efter "timeout" gentager programmet visningen af den bestemte fil. Jeg kan se det samme i "Serial overvågningen" så det er helt sikkert mine evner indenfor kode skrivning der halter.
Vil du kigge på Sketch'en, og give et bud på hvor jeg kan sætte en bremse, så Serial.println... kun bliver sendt en gang?.
På forhånd tak.

int kon1 = 7;//kontakt1
int kon2 = 8;//kontakt2
int val1 = 0;
int val2 = 0;

void setup()
{
pinMode(kon1, INPUT);
pinMode(kon2, INPUT);
Serial.begin(9600);

}

void loop()

{
val1 = digitalRead(kon1);
val2 = digitalRead(kon2);

val1 =!val1;
val2 =!val2;
if (val1 == HIGH)
{
Serial.println("#S|MUSIK1|[]#");
delay(val1);
}
if (val2 == HIGH)
{
Serial.println("#S|BILLED1|[]#");
delay(val2);

}}

Guys, this is an English language forum, so please provide translations, so others can help, or be helped.

Sorry, you are right. So here is translation of the pre posting.

When i am sending Serial.println(XXXXXX) to my PC the "Code" is send many times, I just want the arduino to send it once.
I need something in the sketch to control the how many times Serial.println is send.
The sketch looks like this....

int kon1 = 7;//button1
int kon2 = 8;//button2
int val1 = 0;
int val2 = 0;

void setup()
{
pinMode(kon1, INPUT);
pinMode(kon2, INPUT);
Serial.begin(9600);
}
void loop()
{
val1 = digitalRead(kon1);
val2 = digitalRead(kon2);

val1 =!val1;
val2 =!val2;
if (val1 == HIGH)
{
Serial.println("#S|MUSIK1|[]#");
delay(val1);
}
if (val2 == HIGH)
{
Serial.println("#S|BILLED1|[]#");
delay(val2);
}

When i am sending Serial.println(XXXXXX) to my PC the "Code" is send many times, I just want the arduino to send it once.

Then, you need to send only when a transition occurs, not whenever the state is HIGH or LOW.

Detecting a transition is simply a matter of comparing the current state of the switch with the previous state, If they are not the same, a transition occurred. At the end of loop(). set the previous state to the current state, ready for next time.

Hi PaulS

That make sense....thank you so far...

But, i am total NewBie...so is it possible that you could "challenge" me with some hints, of what to write in the sketch??? XD

Regards
LYDFANGER

so is it possible that you could "challenge" me with some hints, of what to write in the sketch?

// Global variables
int currState1;
int prevState1;
int currState2;
int prevState2;
void loop()
{
   currState1 = digitalRead(kon1);
   if(currState1 != prevState1)
   {
      // A transition occurred - from pressed to released or from released to pressed
      if(currState1 == HIGH)
      {
         // The transition was to whatever state HIGH represents
         // Could be pressed or released, depending on how the
         // switch is wired

         // Do whatever needs to be done once when the switch is HIGH
      }
   }
   prevState1 = currState1;
}

I'm guessing that you can figure out what needs to be done for the other pin, and what needs to be merged where in that code, based on the comments.

You do have external resistors wired with your switches, don't you? Not that I understand why you don't keep it simpler and use the internal pullup resistors.

Hi again

Thank you very much.

I do understand, and i am able to merge the right way.

You are right, i am using pullup with resistor on the breadboard.

as you know i am a newbie, so when you say internal resistor, I think: Is that a "speciel pin" or how is that working?

All the digital pins on the Arduino have internal pullup resistors. These can be activated by calling digitalWrite() with the second argument being HIGH (the first is the pin number) after the pin is set to INPUT (using pinMode()).

If you really are using an external pullup resistor, the pin would read LOW when the switch was pressed, and HIGH when not pressed (for a normally open switch).

Using the internal pullup resistor is easy. In setup():

pinMode(kon1, INPUT); // Make pin INPUT
digitalWrite(kon1, HIGH); // Turn on pullup resistor

Then, connect one leg of the switch to pin 7 and the other leg to ground. No external resistor needed.

In loop(), read the switch in the normal way. LOW == pressed, and HIGH == released.

Hi again,again

What you are writing explains why I had to use "val = !val" to make HIGH == 1 and LOW ==0.

Where can I find info about "Hardware features" like the internal resistor, i guess it is not the only hardware feature on the board?

Now I will use some time "to play" with the "new information" you just have given me.

Once more:

Thank very,very much.
Regards
LYDFANGER

Where can I find info about "Hardware features" like the internal resistor, i guess it is not the only hardware feature on the board?

Start here: http://arduino.cc/en/Main/Hardware
Pick whichever board you have, and read all the details, even if you don't think you will use them (yet).

PaulS:

Where can I find info about "Hardware features" like the internal resistor, i guess it is not the only hardware feature on the board?

Start here: http://arduino.cc/en/Main/Hardware
Pick whichever board you have, and read all the details, even if you don't think you will use them (yet).

I still don't quite believe this but the documentation for 1.0 sounds like the pullups are not active for pinMode(INPUT). This would break a lot of my pinMode() - Arduino Reference
.

I still don't quite believe this but the documentation for 1.0 sounds like the pullups are not active for pinMode(INPUT).

They are not active by default. They can be activated, using digitalWrite(). Or, the call to digitalWrite() is made for you if you use the type INPUT_PULLUP.

I think that the "disabled" in that sentence refers to the fact that there is now a call to digitalWrite() in the pinMode() function. It is called with HIGH or LOW based on the use of INPUT_PULLUP vs. INPUT.

A peak at the code confirms this. The digitalWrite() function isn't actually called, but the equivalent register manipulations occur.

I'm on windows 7, and the example code from here http://electronics.divinechildhighschool.org/Home/Arduino-Lessons/using-gobetwino-to-control-windows-through-arduino doesn't seem to work -iTunes doesn't even seem to open.

PaulS:

I still don't quite believe this but the documentation for 1.0 sounds like the pullups are not active for pinMode(INPUT).

They are not active by default. They can be activated, using digitalWrite(). Or, the call to digitalWrite() is made for you if you use the type INPUT_PULLUP.

Whew, thanks.

I think that the "disabled" in that sentence refers to the fact that there is now a call to digitalWrite() in the pinMode() function. It is called with HIGH or LOW based on the use of INPUT_PULLUP vs. INPUT.

A peak at the code confirms this. The digitalWrite() function isn't actually called, but the equivalent register manipulations occur.

Is there any reason that this doesn't work for Windows 7? I would really like to use Gobetwino.