Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

JavaScript - Industrial Quad Relay Bricklet - setMonoflop

Featured Replies

Geschrieben

Hallo zusammen,

 

ich versuche gerade mittels JavaScript die Pins 0 bis 3 einzeln mittels Monoflop zu schalten. Ich habe vier Buttons auf der Webseite die jeweils alle dieselbe Funktion aufrufen und immer einen Wert mit übergeben. Z.B. 0 für den Pin 0. Die Funktion soll dann in diesem Fall den Pin 0 für eine kurze Zeit (z.B. 10 Sekunden) schließen.

 

Ich habe dann in die Doku geschaut und ich werde leider aus einem Satz nicht schlau (siehe Anhang).

 

Den zweiten und dritten Parameter habe ich hoffentlich richtig verstanden.

Der zweite gibt jeweils den gewünschten Zustand der jeweiligen Pins an und der dritte Parameter gibt einfach die Zeit in ms an.

 

Was muss ich aber für den ersten Parameter eintragen?

 

Ich habe nun folgendes in meinem html Dokument eingetragen:

 

if (pin == 0)
{
	iqr.setMonoflop(1, 1, 10000);
}
if (pin == 1)
{
	iqr.setMonoflop(1, 2, 10000);
}
if (pin == 2)
{
	iqr.setMonoflop(1, 4, 10000);
}
if (pin == 3)
{
	iqr.setMonoflop(1, 8, 10000);
}

 

 

Kann mir hier evtl. jemand weiterhelfen was ich anstelle der 1 eintragen muss? Oder habe ich auch den zweiten Parameter falsch verstanden?

 

Vielen Dank.

 

Grüße

Unex

setMonoflop.PNG.5186c7d5d35f68f2c7b57dc1bb66f4ce.PNG

Geschrieben

Die erste Bitmaske gibt an welche Pins geschaltet werden sollen und die zweite Bitmaske gibt an welchen Zustand die Pins haben sollen. deinen kompletten Code kannst du ersetzen durch:

iqr.setMonoflop(1 << pin, 1 << pin, 10000);

Geschrieben
  • Autor

Klasse für deine schnelle Antwort und Erklärung.

 

Top die Lösung ist am Besten :)

 

Viele Grüße

Unex

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.