Challenge

Have you ever seen nightlights that come on when it gets dark in a room? Chances are it is using a light sensor. You can program your Edison to do the same thing! See if you can write a program that tells Edison to turn on its LEDs when it detects very little visible light but to turn the LEDs off the rest of the time. 

  • When it comes to expressions and any mathematics in EdScratch programs, it is important to note that Edison can only handle integers. Likewise, Edison can only work in ‘real’ mathematics, so if you put in computations which, for example, divide by zero, you may get errors, or the robot may behave in unexpected ways.
  • If an operator input parameter is left blank in an EdScratch program, it will be read as ‘0’ (zero) by the robot.
    • The operator may display NaN in the input parameter space in this case, which stands for ‘not a number’. 
  • Edison will detect all ambient visible light and is unable to determine the source of the light. Take into consideration how bright or dark the room is when testing programs using Edison’s light sensors. 
  • You are encouraged to test different values in the expressions you are using with light sensor readings to find what works best with your robot in the environment where you are running your program. 

Answers and notes from [2 p. 128-129].