Affecter les entrées aux relais « Mode poussoir » :
// Loop over all the buttons
for(i = 0; i < 4; i++) {
if(getXMLValue(xmlData, 'btn'+i) == 'up') // If button is up
{
document.getElementById('btn' + i).innerHTML = '0';
if(stateChanged0 == 1 && i == 3)
switchLED0 = 1;
//if(i==3) // If button 0 is pressed, put the button state in currentState
// currentState = 0;
}
else // If buton is down
{
document.getElementById('btn' + i).innerHTML = '1';
stateChanged0 = 1;
//if(i==3) // If button 0 is pressed, put the button state in currentState
// currentState = 1;
}
}
// Update analog value
document.getElementById('an1').innerHTML = getXMLValue(xmlData, 'an1');
document.getElementById('an2').innerHTML = getXMLValue(xmlData, 'an2');
// Update the time value
document.getElementById('time0').innerHTML = getXMLValue(xmlData, 'time0');
// Impulse mode
// Check the state of the button changed from the last time we checked
// This check is made to prevent LED flashing when pressing and releasing the button
//if (lastState != currentState) // If the state changed
//{
// newAJAXCommand(‹ leds.cgi?led=0 ›); // Call the function that switch the LED (same function as clicking on the LED)
// lastState = currentState; // Update the last state
//}
// Push mode
if (switchLED0 == 1) // If the state changed
{
switchLED0 = 0; // Reset variable to avoid LED flashing
stateChanged0 = 0;
newAJAXCommand(‹ leds.cgi?led=0 ›); // Call the function that switch the LED (same function as clicking on the LED)
}
// Loop over all the buttons
for(i = 0; i < 4; i++) {
if(getXMLValue(xmlData, ‹ btn ›+i) == ‹ up ›) // If button is up
{
document.getElementById(‹ btn › + i).innerHTML = ‹ 0 ›;
if(i==3) // If button 0 is pressed, put the button state in currentState
currentState = 0;
}
else // If buton is down
{
document.getElementById(‹ btn › + i).innerHTML = ‹ 1 ›;
if(i==3) // If button 0 is pressed, put the button state in currentState
currentState = 1;
}
}
Bonjour à tous,
Je voudrais faire de ma carte ipx 800 une entrale d’alarme, je voulais savoir si quelqu’un avais un js qui ferait que par exemple quand l’entrée digitale 1 est enclenchée, sa active le relai 1 et 3 par exenple.
salut a tous, jai essayer de mettre ce script sur index.html :
// Loop over all the buttons
for(i = 0; i < 4; i++) {
if(getXMLValue(xmlData, ‹ btn ›+i) == ‹ up ›) // If button is up
{
document.getElementById(‹ btn › + i).innerHTML = ‹ 0 ›;
if(i==3) // If button 0 is pressed, put the button state in currentState
currentState = 0;
}
else // If buton is down
{
document.getElementById(‹ btn › + i).innerHTML = ‹ 1 ›;
if(i==3) // If button 0 is pressed, put the button state in currentState
currentState = 1;
}
}
, mai sa fait complètement planter la page et les compteurs dentrees, je voulais savoir si il était possible davoir la page complète, et avoir plus de détails sur lutilisation de ce script.