Parameters

Toggle (Pro)

Pro Feature

This is an exclusive feature of NetWizard Pro. Check it out here.

Toggle

You can create an Toggle parameter type that will be displayed as a clickable toggle switch on the configuration page. Toggle parameter takes integer values and return 0 or 1 depending on toggle state.

Constructor

The constructor of Toggle parameter type takes 2 useful parameters:

  • name - The name of the parameter
  • value - The default value of the parameter (optional)
NetWizardParameter nw_toggle(&NW, NW_TOGGLE, "Name", 0);

API Reference

Initialization

NetWizard NW(&server);

NetWizardParameter nw_toggle(&NW, NW_TOGGLE, "Toggle", 0); // <-- add this line

void setup() {
  ...
}

void loop() {
  ...
}

Getters

// Store the value of the toggle in `val` using `getValue`
int val;
nw_toggle.getValue(val);
int val = nw_toggle.getValueInt(); // <-- get value inline

Setters

// Set the value of the toggle using `setValue`
nw_toggle.setValue(1);
Previous
Password Input (Pro)