This code has two main functions indicated, one is when the square button is pressed, and the other is when the circle is pressed. So when we press square what it does is turn on the radio, and when we press circle we stop the radio.

JSON code:

{	"do": [		{			"on": {				"do": [					{						"radio": {							"play": 1,							"url": "http://icestreaming.rai.it/1.mp3"						}					}				],				"event": "touchSquare"			}		},		{			"on": {				"do": [					{						"radio": {							"play": 0						}					}				],				"event": "touchCircle"			}		}	]}
  • Lesson 6: Conditions

    This code begins with the timer function, which indicates that every 1 second, running infinitely, it will perform the indicated function. In this case, we have used the ‘If’ function, to indicate that if the position of the cube is two, a white LED will light up, we achieve this with the ‘if’ function and

    Read more