Webduino Bit has many kinds of built-in sensors, one of which is photocell. There are two photocells on-board through which user can measure the intensity of light, or uses both interactively to implement more tasks in smart home.
Open Webduino Blockly Bit experimental version, place the “development board” block to edit area, the development board uses simulator by default, connect with virtual Bit board as shown in the picture, the preset Device ID is 1234
Blocks relate to development board are in the menu of development board.
To use physical Bit board, please choose the “Wi-Fi” in the drop down list and enter the corresponding Device ID.
Place two “photocell setup” blocks on the development board, set“upper left” or “upper right” in the rear drop list, and use “new value” in the front drop list of the block,name it “left” or “right” accordingly.
All the blocks relate to photo cell are in the “photo cell” menu.
Click upper right menu to open web interactive area, choose “display text” in the drop down list, the corresponding blocks will be displayed on the left.
Since there are two photo cells, if both are to be used, please put both “left” and “right” blocks together.
“variable” blocks must be used in order to display values of both two photocells, in the below variable “L” is used to store the value of left photocell, and variable “R” to store the value for the right photocell.
Variable blocks are in the “variable” menu.
Use “display” block and “new string” block to display both R and L values in the web interactive area. Click “blue gear” in the “new string” menu to create new combination point, use comma as separation.
Blocks of “new strings” are in the “basic function >text” menu.
Click the upper right red button to run, a light bulb and a flame picture will be displayed at the bottom of the virtual bit development board. The value of photocell varies when dragging the bulb close to photocell. If using physical bit development board,the value of photocell changes when exposing photocell to light or blocking the light.
Logical interaction (lighting a web light bulb)
Having been able to acquire the value of the photocell, let’s go further with a virtual light bulb control through simple logic judgement, only one photo cell to be used, say upper left one, name it “left”
Open web interactive area, choose “click bulb” in the drop down list, corresponding blocks will display on the left.
Place “logic judgement” block to it, the logic is to switch on light bulb when the value of photo cell is greater than 0.7,otherwise switch off. Click “blue gear” block to add new logic judgement.
Logic related blocks are in the menu of “basic function>logic”, numeric blocks are in the menu of “basic function>math”
Press the red button on the upper right to run, a light bulb and a flame picture will display , move the bulb close to the photo cell, the bulb turns off, move the bulb away, the bulb turns on .The same will be observed with physical Bit development board by shedding light to or blocking the light to the photocell.
How to get Webduino Bit
Buy Webduino Bit：Online Store
Email to：Customer Service Email