Skip to main content

imp.getchannel()

Returns the WiFi channel in which the imp is currently operating

Availability

Device (from impOS™ 33)
DEPRECATED METHOD — DO NOT USE IN NEW CODE

Returns

The current WiFi channel as an integer, otherwise zero

Description

This method is now deprecated. However, removing it altogether would cause users’ existing code to stop working, so we currently have no plans to do so. The recommended means of gaining the information this method returns is to call imp.net.info().

This method tells you in which WiFi channel an imp is currently using to communicate with its access point. If the imp is capable of connecting in the 5GHz band and has done so, the value returned will be in the range 36 through 165, depending on regulatory territory (see Wikipedia’s ‘List of WiFi Channels’).

Other imps, and those connecting in the 2.4GHz band anyway, will report a value in the range 1 through 13, again depending on regulatory territory: US imps will only connect using 2.4GHz channels 1 through 11; those intended for other regions can also access channels 12 and 13.

If the imp is not connected to WiFi — it may be disconnected, or connected via wired Ethernet, for example — the method returns zero.

Note This method has been removed from versions of impOS running on the impC001.