FunKey Super has a Scratch KeyStream mode, which delivers real time sensor data by streaming keystrokes which indicate the value of a sensor. This works in Javascript and Scratch and DOES NOT require installing the Scratch plug in.  The advantage is that it provides realtime sensor input  from FunKey Super's analog input connections, and gives you good resolution from a sensor, about 10 bits.  The coding for Scratch is provided and the sample project even has a graphing function to show values, and a sampling function, which you can adjust for your purpose.  For a long term sensing project, like tracking soil moisture overnight, you might take readings every five minutes, while for more short-term projects like taking temperature, you might want samples every .1 seconds.  The sample project displays values in a graph in the Scratch screen and optionally also sends those readings into a Scratch list, which can be exported, if you like, to a file that can be used in Excel.  This is great for science experiments, or realtime gaming input to Scratch from sensors.


In addition, there is a sub-mode called LightGate, which enables microsecond-level timing that is otherwise not possible with Javascript or Scratch.  To use this sub-mode, "ground" port W and attach a sensor like the IR reflection sensor to port G.  Every time the sensor "sees" an object moving past it, it will send a string of numbers representing the elapsed time in microseconds.  Thus it acts as a "light gate" to enable measurement of the "instantaneous speed" of moving or falling balls.  Just divide their width by the elapsed time to determine their speed.


Here's how to set the FunKey Super into KeyStream mode:


Unplug the board from the USB if it's connected

Use an alligator clip to by connecting the A and I hole pairs.

Plug  the FunKey Super board to the USB port

The blue LED labeled Keystroke Mode will be bright, and the blue LED labeled "I/O Mode will be lit, but dim.

Remove the alligator clip.  You are now in Scratch KeyStream Mode 

Be sure to attach a pot to port H to control the flow of keystrokes.  You'll need to make sure it's OFF (fully clockwise) when you connect the board to your computer's USB port.



We have a sample Scratch program you can use to receive streaming data from a sensor connected to the connector labeled "M" (remember that the potentiometer must be connected to port H to control keystroke flow speed:


Because FunKey Super KeyStream sends a steady stream of keystrokes to the USB port (and then to Scratch) it's important to have a flow control switch, othewise your normal work on the computer will be flooded with a stream of keystrokes.  While you can just unplug the USB cable from Funkey Super, we have enabled a speed-control mechanism for the flow of keystroke data. Attach the supplied potentiometer to the H port to control the flow.  Fully clockwise should be "off", and   The sample Scratch program also has an interval variable which you can use to specify the rate of data capture.


NOTE:  You can't stop the data coming in by clicking the Scratch red "stop" button.  You must turn the potentiometer on the FunKey Super's H port fully clockwise to stop the data keystroke flow.  Also, in this example code, only the sensor on port M (A0) is being captured.  Port L(A1) is also available in the keystream data for advanced users.

FunKey Super KeyStream Mode

works with Scratch and Javascript (A/I)

and LightGate Mode

NOTE:  this feature is functional, but still under development