Bonjour,
Tout d'abords j'explique mon probleme :
Je dois envoyer une requète GET de Arduino vers du PHP apres appuie sur un bouton poussoir (placé sur la platine Arduino), et tout cela doit ouvrir une page HTML-PHP. J'ai vu beaucoup de site qui en parlait mais j'ai rien trouvé d’intéressant...
Je vous donne mon code (en esperant qu'une ame charitable m'aide) :
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function PopupCentrer(page,largeur,hauteur,options) {
var top=(screen.height-hauteur)/2;
var left=(screen.width-largeur)/2;
window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}
</SCRIPT>
</HEAD>
<body>
<?php
/*// le code PHP
function open_infos()
{
window.open('https://www.google.fr/','nom_de_ma_popup','menubar=no, scrollbars=no, top=100, left=100, width=300, height=200');
}
?>
*/
<!-- retour au code HTML --->
<form>cliquez sur ce bouton :
<input type='button' value='Action sur portail' onClick='PopupCentrer("https://www.google.fr/",500,70,"menubar=no,scrollbars=no,statusbar=no")'>
</form>
</body>
</HTML>et mon code Arduino :
const int APPUI=1;
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
int ETAT_BP;
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
digitalWrite (buttonPin, HIGH);
}
void loop(){
ETAT_BP=digitalRead(buttonPin);
if (ETAT_BP==APPUI){
digitalWrite(ledPin, 1);
delay(180000);
}
else {
digitalWrite(ledPin, 0);
}
}Merci d'avance ![]()
Dernière modification par Kévin51 (2014-05-14 14:55:23)
Hors ligne