====== Webpage Digital Output Pulse ====== This Skript will offer an additional webpage on the Web Manager HOME Page. You can trigger a Pulsesignal on the two Digital Outputs with a specific Length This Way you can trigger a external Reset Signal for a device, e.g. a PC or a Measurment Device. The Page can also be view by restricted non-admin users. {{ :sdk:dio.png?nolink |}} ===== Requirements ===== Please have at least NRSW [[https://share.netmodule.com/public/system-software/4.0/4.0.0.106/|4.0.0.106]] installed ===== Installation ===== Please combine this script with the sdk-startup trigger into a job {{ :sdk:diojob1.png?nolink |}} ===== The Script ===== /* DESC: This script will generate a page which can be viewed in the Web Manager * You can trigger a pulse signal on the Digital Output of a specific length * Copyright (C) 2017 NetModule AG, Switzerland, jj */ ID=1; timeout1=(int)nb_config_get("custom.var1"); timeout2=(int)nb_config_get("custom.var2"); bool diopulse(string ifc, int timeout) { nb_syslog("We a sending a pulse on %s, length %d",ifc,timeout); nb_dio_set(ifc,1); sleep(timeout); nb_dio_set(ifc,0); return true; } page = nb_userpage_register(ID, "Trigger", "DIO"); printf("waiting for requests...\n"); while (1) { /* wait for page request */ request = nb_page_request(page); if (!is_void(request)){ /* evaluate GET params */ htable = mkstruct("key","value"); GET = struct_get(request, "GET"); for (k = 0; k < length(GET); k++) { key = struct_get(GET[k], "key"); value = struct_get(GET[k], "value"); htable = struct_set(htable,key,value); } reqifc=struct_get(htable,"ifc"); reqlength=(int) struct_get(htable,"length"); if (strlen(reqifc)>0 && is_int(reqlength)){ diopulse(reqifc,reqlength); if(reqifc=="out1") { timeout1=reqlength; nb_config_set(sprintf("custom.var1=%i",timeout1)); } if(reqifc=="out2") { timeout2=reqlength; nb_config_set(sprintf("custom.var2=%i",timeout2)); } } } nb_page_respond(page,'

Digital I/O Port Pulse

This button will close the Relais on the regarding OUTPUT for a specific time and open it again afterwards

Digital Out 1:
length in sec
Digital Out 2:
length in sec
',timeout1,ID,timeout2,ID); nb_page_finish(page); sleep(1); }