Buscar

Codigo final prog

Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original

project.json
{
	"objName": "Stage",
	"variables": [{
			"name": "temperatura",
			"value": 0,
			"isPersistent": false
		},
		{
			"name": "tempo",
			"value": 330,
			"isPersistent": false
		},
		{
			"name": "linha t",
			"value": 6,
			"isPersistent": false
		}],
	"lists": [{
			"listName": "lista_temperatura",
			"contents": ["40", "70", "150", "110", "175", "140", 0, 0],
			"isPersistent": false,
			"x": 10,
			"y": 22,
			"width": 109,
			"height": 204,
			"visible": true
		},
		{
			"listName": "lista_tempo",
			"contents": ["30", "60", "90", "120", "150", "180", 2, 330],
			"isPersistent": false,
			"x": 117,
			"y": 28,
			"width": 104,
			"height": 204,
			"visible": true
		}],
	"scripts": [[53,
			75,
			[["whenGreenFlag"],
				["setVar:to:", "tempo", "2"],
				["doForever",
					[["setVar:to:", "temperatura", ["Arduino.getAnalog", 10]],
						["append:toList:", ["readVariable", "tempo"], "lista_tempo"],
						["append:toList:", ["readVariable", "temperatura"], "lista_temperatura"],
						["wait:elapsed:from:", 150],
						["changeVar:by:", "tempo", 150]]]]]],
	"sounds": [{
			"soundName": "pop",
			"soundID": 0,
			"md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav",
			"sampleCount": 258,
			"rate": 11025,
			"format": ""
		}],
	"costumes": [{
			"costumeName": "cenário1",
			"baseLayerID": 3,
			"baseLayerMD5": "739b5e2a2435f6e1ec2993791b423146.png",
			"bitmapResolution": 1,
			"rotationCenterX": 240,
			"rotationCenterY": 180
		}],
	"currentCostumeIndex": 0,
	"penLayerMD5": "11f7e161043e867c534fd210e449b0d7.png",
	"penLayerID": 0,
	"tempoBPM": 60,
	"videoAlpha": 0.5,
	"children": [{
			"target": "Stage",
			"cmd": "getVar:",
			"param": "temperatura",
			"color": 15629590,
			"label": "temperatura",
			"mode": 1,
			"sliderMin": 0,
			"sliderMax": 100,
			"isDiscrete": true,
			"x": 5,
			"y": 5,
			"visible": true
		},
		{
			"objName": "Bolinha",
			"variables": [{
					"name": null,
					"value": 0,
					"isPersistent": false
				}],
			"lists": [{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				},
				{
					"listName": null,
					"contents": [],
					"isPersistent": false,
					"x": 0,
					"y": 0,
					"width": 102,
					"height": 202,
					"visible": false
				}],
			"scripts": [[36.5,
					5.25,
					[["whenGreenFlag"],
						["setVar:to:", "linha t", 0],
						["setVar:to:", "tempo", 0],
						["setVar:to:", "temperatura", 0],
						["putPenUp"],
						["clearPenTrails"],
						["gotoX:y:", 0, 0],
						["putPenDown"],
						["wait:elapsed:from:", 1],
						["changeVar:by:", "linha t", 1],
						["setVar:to:", "tempo", ["getLine:ofList:", 1, "lista_tempo"]],
						["setVar:to:", "temperatura", ["getLine:ofList:", 1, "lista_temperatura"]],
						["gotoX:y:", ["readVariable", "tempo"], ["readVariable", "temperatura"]],
						["wait:elapsed:from:", 1],
						["setVar:to:", "linha t", ["+", ["readVariable", "linha t"], 1]],
						["setVar:to:", "tempo", ["getLine:ofList:", ["readVariable", "linha t"], "lista_tempo"]],
						["setVar:to:", "temperatura", ["getLine:ofList:", ["readVariable", "linha t"], "lista_temperatura"]],
						["gotoX:y:", ["readVariable", "tempo"], ["readVariable", "temperatura"]],
						["wait:elapsed:from:", 1],
						["setVar:to:", "linha t", ["+", ["readVariable", "linha t"], 1]],
						["setVar:to:", "tempo", ["getLine:ofList:", ["readVariable", "linha t"], "lista_tempo"]],
						["setVar:to:", "temperatura", ["getLine:ofList:", ["readVariable", "linha t"], "lista_temperatura"]],
						["gotoX:y:", ["readVariable", "tempo"], ["readVariable", "temperatura"]],
						["wait:elapsed:from:", 1],
						["setVar:to:", "linha t", ["+", ["readVariable", "linha t"], 1]],
						["setVar:to:", "tempo", ["getLine:ofList:", ["readVariable", "linha t"], "lista_tempo"]],
						["setVar:to:", "temperatura", ["getLine:ofList:", ["readVariable", "linha t"], "lista_temperatura"]],
						["gotoX:y:", ["readVariable", "tempo"], ["readVariable", "temperatura"]],
						["wait:elapsed:from:", 1],
						["setVar:to:", "linha t", ["+", ["readVariable", "linha t"], 1]],
						["setVar:to:", "tempo", ["getLine:ofList:", ["readVariable", "linha t"], "lista_tempo"]],
						["setVar:to:", "temperatura", ["getLine:ofList:", ["readVariable", "linha t"], "lista_temperatura"]],
						["gotoX:y:", ["readVariable", "tempo"], ["readVariable", "temperatura"]],
						["wait:elapsed:from:", 1],
						["setVar:to:", "linha t", ["+", ["readVariable", "linha t"], 1]],
						["setVar:to:", "tempo", ["getLine:ofList:", ["readVariable", "linha t"], "lista_tempo"]],
						["setVar:to:", "temperatura", ["getLine:ofList:", ["readVariable", "linha t"], "lista_temperatura"]],
						["gotoX:y:", ["readVariable", "tempo"], ["readVariable", "temperatura"]],
						["putPenUp"]]]],
			"sounds": [{
					"soundName": "pop",
					"soundID": 0,
					"md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav",
"sampleCount": 258,
					"rate": 11025,
					"format": ""
				}],
			"costumes": [{
					"costumeName": "caracterização1",
					"baseLayerID": 1,
					"baseLayerMD5": "afe5b4db25c72b316c6250a9570f7d98.svg",
					"bitmapResolution": 1,
					"rotationCenterX": 3,
					"rotationCenterY": 3
				}],
			"currentCostumeIndex": 0,
			"scratchX": 180,
			"scratchY": 140,
			"scale": 1,
			"direction": 90,
			"rotationStyle": "normal",
			"isDraggable": false,
			"indexInLibrary": 2,
			"visible": true,
			"spriteInfo": {
			}
		},
		{
			"target": "Stage",
			"cmd": "getVar:",
			"param": "tempo",
			"color": 15629590,
			"label": "tempo",
			"mode": 1,
			"sliderMin": 0,
			"sliderMax": 100,
			"isDiscrete": true,
			"x": 136,
			"y": 5,
			"visible": true
		},
		{
			"objName": "Plano Cartesiano",
			"sounds": [{
					"soundName": "pop",
					"soundID": 0,
					"md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav",
					"sampleCount": 258,
					"rate": 11025,
					"format": ""
				}],
			"costumes": [{
					"costumeName": "caracterização1",
					"baseLayerID": 2,
					"baseLayerMD5": "794434c1db8eb743ea03c4200b877911.svg",
					"bitmapResolution": 1,
					"rotationCenterX": 9,
					"rotationCenterY": 180
				}],
			"currentCostumeIndex": 0,
			"scratchX": -1,
			"scratchY": 0,
			"scale": 1,
			"direction": 90,
			"rotationStyle": "normal",
			"isDraggable": false,
			"indexInLibrary": 1,
			"visible": true,
			"spriteInfo": {
			}
		},
		{
			"listName": "lista_tempo",
			"contents": ["30", "60", "90", "120", "150", "180", 2, 330],
			"isPersistent": false,
			"x": 117,
			"y": 28,
			"width": 104,
			"height": 204,
			"visible": true
		},
		{
			"target": "Stage",
			"cmd": "getVar:",
			"param": "linha t",
			"color": 15629590,
			"label": "linha t",
			"mode": 1,
			"sliderMin": 0,
			"sliderMax": 100,
			"isDiscrete": true,
			"x": 5,
			"y": 240,
			"visible": true
		},
		{
			"listName": "lista_temperatura",
			"contents": ["40", "70", "150", "110", "175", "140", 0, 0],
			"isPersistent": false,
			"x": 10,
			"y": 22,
			"width": 109,
			"height": 204,
			"visible": true
		}],
	"info": {
		"swfVersion": "v3.4.11",
		"spriteCount": 2,
		"videoOn": false,
		"boardVersion": "mbot_uno",
		"scriptCount": 2,
		"flashVersion": "WIN 19,0,0,169",
		"savedExtensions": [{
				"menus": {
					"notes": ["C2",
						"D2",
						"E2",
						"F2",
						"G2",
						"A2",
						"B2",
						"C3",
						"D3",
						"E3",
						"F3",
						"G3",
						"A3",
						"B3",
						"C4",
						"D4",
						"E4",
						"F4",
						"G4",
						"A4",
						"B4",
						"C5",
						"D5",
						"E5",
						"F5",
						"G5",
						"A5",
						"B5",
						"C6",
						"D6",
						"E6",
						"F6",
						"G6",
						"A6",
						"B6",
						"C7",
						"D7",
						"E7",
						"F7",
						"G7",
						"A7",
						"B7",
						"C8",
						"D8"],
					"beats": ["Half", "Quarter", "Eighth", "Whole", "Double", "Zero"],
					"pwmvalue": ["0", "50", "100", "150", "255"],
					"digital": ["HIGH", "LOW"],
					"servovalue": ["0", "45", "90", "135", "180"]
				},
				"blockSpecs": [["h", "Arduino Program", "runArduino"],
					["B",
						"read digital pin %n",
						"getDigital",
						"9",
						{
							"loop": "",
							"def": "",
							"setup": "pinMode({0},INPUT);\n",
							"inc": "",
							"encode": "{d0}",
							"work": "digitalRead({0})"
						}],
					["R",
						"read analog pin (A)%n",
						"getAnalog",
						"0",
						{
							"loop": "",
							"def": "",
							"setup": "pinMode(A0+{0},INPUT);\n",
							"inc": "",
							"encode": "{d0}",
							"work": "analogRead(A0+{0})"
						}],
					["R",
						"read pulse pin %n timeout %n",
						"getPulse",
						"13",
						20000,
						{
							"loop": "",
							"def": "",
							"setup": "pinMode({0},INPUT);\n",
							"inc": "",
							"encode": "{d0}",
							"work": "pulseIn({0},HIGH,{1})"
						}],
					["w",
						"set digital pin %n output as %d.digital",
						"runDigital",
						"9",
						"HIGH",
						{
							"loop": "",
							"def": "",
							"setup": "pinMode({0},OUTPUT);\n",
							"inc": "",
							"encode": "{d0}{d1}",
							"work": "digitalWrite({0},{1});\n"
						}],
					["w",
						"set pwm pin %n output as %d.pwmvalue",
						"runPwm",
						"5",
						0,
						{
							"loop": "",
							"def": "",
							"setup": "pinMode({0},OUTPUT);\n",
							"inc": "",
							"encode": "{d0}{d1}",
							"work": "analogWrite({0},{1});\n"
						}],
					["w",
						"play tone pin %n on note %d.notes beat %d.beats",
						"runTone",
						"9",
						"C4",
						"Half",
						{
							"loop": "",
							"def": "",
							"setup": "pinMode({0},OUTPUT);\n",
							"inc": "",
							"encode": "{d0}{s1}{s2}",
							"work": "tone({0},{1},{2}); \/\/ write to buzzer\ndelay({2});\n"
						}],
					["w",
						"set servo pin %n angle as %d.servovalue",
						"runServoArduino",
						"9",
						90,
						{
							"loop": "",
							"def": "Servo servo_{0};\n",
							"setup": "servo_{0}.attach({0}); \/\/ init pin\n",
							"inc": "#include <Servo.h>\n",
							"encode": "{d0}{d1}",
							"work": "servo_{0}.write({1}); \/\/ write to servo\n"
						}],
					["w",
						"serial write text %s",
						"serialWrite",
						"hello",
						{
							"inc": "",
							"loop": "",
							"work": "Serial.println({0});\n",
							"setup": "Serial.begin(115200);\n",
							"def": ""
						}],
					["R",
						"serial available bytes",
						"serialAvailable",
						{
							"inc": "",
							"loop": "",
							"work": "Serial.available()",
							"setup": "Serial.begin(115200);\n",
							"def": ""
						}],
					["R",
						"serial read byte",
						"serialRead",
						{
							"inc": "",
							"loop": "",
							"work": "Serial.read()",
							"setup": "Serial.begin(115200);\n",
							"def": ""
						}],
					["R",
						"read ultrasonic sensor trig pin %n echo pin %n",
						"getUltrasonicArduino",
						13,
						12,
						{
							"loop": "",
							"def": "--separator--float getDistance(int trig,int echo){\npinMode(trig,OUTPUT);\ndigitalWrite(trig,LOW);\ndelayMicroseconds(2);\ndigitalWrite(trig,HIGH);\ndelayMicroseconds(10);\ndigitalWrite(trig,LOW);\npinMode(echo, INPUT);\nreturn pulseIn(echo,HIGH,30000)\/58.0;\n}\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}",
							"work": "getDistance({0},{1})"
						}],
					["R",
						"timer",
						"getTimer",
						"0",
						{
							"loop": "",
							"def": "double currentTime = 0;\ndouble lastTime = 0;\n--separator--double getLastTime(){\n\treturn currentTime = millis()\/1000.0 - lastTime;\n}\n",
							"setup": "",
							"inc": "",
							"encode": "{n0}",
							"work": "getLastTime()"
						}],
					["w",
						"reset timer",
						"resetTimer",
						"0",
						{
							"loop": "",
							"def": "double currentTime = 0;\ndouble lastTime = 0;\n",
							"setup": "",
							"inc": "",
							"encode": "{n0}",
							"work": "lastTime = millis()\/1000.0;\n"
						}]],
				"extensionName": "Arduino",
				"javascriptURL": "js\/arduino.js"
			},
			{
				"menus": {
					"note": ["C2",
						"D2",
						"E2",
						"F2",
						"G2",
						"A2",
						"B2",
						"C3",
						"D3",
						"E3",
						"F3",
						"G3",
						"A3",
						"B3",
						"C4",
						"D4",
						"E4",
						"F4",
						"G4",
						"A4",
						"B4",
						"C5",
						"D5",
						"E5",
						"F5",
						"G5",
						"A5",
						"B5",
						"C6",
						"D6",
						"E6",
						"F6",
						"G6",
						"A6",
						"B6",
						"C7",
						"D7",
						"E7",
						"F7",
						"G7",
						"A7",
						"B7",
						"C8",
						"D8"],
					"whitePorts": ["Port1", "Port2", "Port3", "Port4"],
					"lport":
["led on board"],
					"index0": ["all", 1, 2, 3, 4],
					"index": ["all", "led left", "led right"],
					"switch": ["Off", "On"],
					"grayPorts": [],
					"beats": ["Half", "Quarter", "Eighth", "Whole", "Double"],
					"fan": ["clockwise", "counter-clockwise", "stop"],
					"bluePorts": ["Port1", "Port2", "Port3", "Port4"],
					"points": [":", ""],
					"servovalue": [0, 45, 90, 135, 180],
					"humiture": ["humidity", "temperature"],
					"laport": ["light sensor on board", "Port3", "Port4"],
					"motorPort": ["M1", "M2"],
					"normalPort": ["Port1", "Port2", "Port3", "Port4"],
					"touch_mode": ["direct", "toggle"],
					"leftRight": ["leftSide", "rightSide"],
					"value": [0, 20, 60, 150, 255],
					"servoPort": ["Port1", "Port2", "Port3", "Port4"],
					"soundPort": ["Port3", "Port4"],
					"slot": ["Slot1", "Slot2"],
					"motorvalue": [255, 100, 50, 0, -50, -100, -255],
					"index2": ["all", 1, 15, 30],
					"direction": ["run forward", "run backward", "turn right", "turn left"],
					"whiteBlack": ["black", "white"],
					"button_key": ["key1", "key2", "key3", "key4"],
					"ircode": ["A",
						"B",
						"C",
						"D",
						"E",
						"F",
						"↑",
						"↓",
						"←",
						"→",
						"Setting",
						"R0",
						"R1",
						"R2",
						"R3",
						"R4",
						"R5",
						"R6",
						"R7",
						"R8",
						"R9"],
					"button_state": ["pressed", "released"],
					"Axis": ["X-Axis", "Y-Axis"],
					"yellowPorts": ["Port1", "Port2", "Port3", "Port4"],
					"shutter": ["Press", "Release", "Focus On", "Focus Off"],
					"GyroAxis": ["X-Axis", "Y-Axis", "Z-Axis"],
					"blackPorts": ["Port3", "Port4"],
					"fanPorts": ["Port1", "Port2", "Port3", "Port4"],
					"port": ["Port1", "Port2", "Port3", "Port4"]
				},
				"blockSpecs": [["h",
						"mBot Program",
						"runArduino",
						{
							"inc": "#include <MeMCore.h>\n",
							"loop": "",
							"src": "mbot",
							"def": "",
							"setup": ""
						}],
					["-"],
					["w",
						"%m.direction at speed %d.motorvalue",
						"runBot",
						"run forward",
						0,
						{
							"loop": "",
							"def": "",
							"setup": "",
							"inc": "",
							"encode": "{d0}{s1}",
							"work": "move({0},{1});\n"
						}],
					["w",
						"set motor%d.motorPort speed %d.motorvalue",
						"runMotor",
						"M1",
						0,
						{
							"loop": "",
							"def": "",
							"setup": "",
							"inc": "",
							"encode": "{d0}{s1}",
							"work": "motor_{0}.run(({0})==M1?-({1}):({1}));\n"
						}],
					["w",
						"set servo %d.servoPort %d.slot angle %d.servovalue",
						"runServo",
						"Port1",
						"Slot1",
						90,
						{
							"loop": "",
							"def": "Servo servo_{0}_{1};\nMePort port_{0}({0});\n",
							"setup": "servo_{0}_{1}.attach(port_{0}.pin{1}());\n",
							"inc": "",
							"encode": "{d0}{d1}{d2}",
							"work": "servo_{0}_{1}.write({2});\n"
						}],
					["w",
						"set led on board %d.index red%d.value green%d.value blue%d.value",
						"runLed",
						"all",
						0,
						0,
						0,
						{
							"loop": "",
							"def": "MeRGBLed rgbled_7(7, 7==7?2:4);\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}{d1}{d2}{d3}",
							"work": "rgbled_7.setColor({0},{1},{2},{3});\nrgbled_7.show();\n"
						}],
					["w",
						"set led %d.yellowPorts %d.index0 red%d.value green%d.value blue%d.value",
						"runLedExternal",
						"Port1",
						"all",
						0,
						0,
						0,
						{
							"loop": "",
							"def": "MeRGBLed rgbled_{0}({0}, {0}==7?2:4);\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}{d1}{d2}{d3}{d4}",
							"work": "rgbled_{0}.setColor({1},{2},{3},{4});\nrgbled_{0}.show();\n"
						}],
					["w",
						"set led strip %d.normalPort %d.slot %d.index2 red%d.value green%d.value blue%d.value",
						"runLedStrip",
						"Port1",
						"Slot2",
						"all",
						0,
						0,
						0,
						{
							"loop": "",
							"def": "MeRGBLed rgbled_{0}_{1}({0}, {1}, 32);\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}{d1}{d2}{d3}{d4}",
							"work": "rgbled_{0}_{1}.setColor({2},{3},{4},{5});\nrgbled_{0}_{1}.show();\n"
						}],
					["w",
						"play tone on note %d.note beat %d.beats",
						"runBuzzer",
						"C4",
						"Half",
						{
							"loop": "",
							"def": "MeBuzzer buzzer;\n",
							"setup": "",
							"inc": "",
							"encode": "{s0}",
							"work": "buzzer.tone({0}, {1});\ndelay(20);\n"
						}],
					["w",
						"show face %d.normalPort number:%n",
						"showNumber",
						"Port1",
						0,
						{
							"loop": "",
							"def": "MeLEDMatrix ledMtx_{0}({0});\n",
							"setup": "ledMtx_{0}.setColorIndex(1);\nledMtx_{0}.setBrightness(6);\n",
							"inc": "",
							"encode": "{s0}",
							"work": "ledMtx_{0}.showNum({1},3);\n"
						}],
					["w",
						"show face %d.normalPort x:%n y:%n characters:%s",
						"showCharacters",
						"Port1",
						0,
						0,
						"Hi",
						{
							"loop": "",
							"def": "MeLEDMatrix ledMtx_{0}({0});\n",
							"setup": "ledMtx_{0}.setColorIndex(1);\nledMtx_{0}.setBrightness(6);\n",
							"inc": "",
							"encode": "{s0}",
							"work": "ledMtx_{0}.drawStr({1},{2}+7,{3});\n"
						}],
					["w",
						"show time %d.normalPort hour:%n %m.points min:%n",
						"showTime",
						"Port1",
						10,
						":",
						20,
						{
							"loop": "",
							"def": "MeLEDMatrix ledMtx_{0}({0});\n",
							"setup": "ledMtx_{0}.setColorIndex(1);\nledMtx_{0}.setBrightness(6);\n",
							"inc": "",
							"encode": "{s0}",
							"work": "ledMtx_{0}.showClock({1},{3},strcmp({2},\":\")==0);\n"
						}],
					["w",
						"show drawing %d.normalPort x:%n y:%n draw:%m.drawFace",
						"showDraw",
						"Port1",
						0,
						0,
						" ",
						{
							"loop": "",
							"def": "MeLEDMatrix ledMtx_{0}({0});\nunsigned char drawBuffer[16];\nunsigned char *drawTemp;\n",
							"setup": "ledMtx_{0}.setColorIndex(1);\nledMtx_{0}.setBrightness(6);\n",
							"inc": "",
							"encode": "{s0}",
							"work": "drawTemp = new unsigned char[16]{{3}};\nmemcpy(drawBuffer,drawTemp,16);\nfree(drawTemp);\nledMtx_{0}.drawBitmap({1},{2},16,drawBuffer);\n"
						}],
					["-"],
					["w",
						"set 7-segments display%d.bluePorts number %n",
						"runSevseg",
						"Port1",
						100,
						{
							"loop": "",
							"def": "Me7SegmentDisplay seg7_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}{f1}",
							"work": "seg7_{0}.display((float){1});\n"
						}],
					["w",
						"set light sensor %d.blackPorts led as %d.switch",
						"runLightSensor",
						"Port3",
						"On",
						{
							"loop": "",
							"def": "MeLightSensor lightsensor_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}{d1}",
							"work": "lightsensor_{0}.dWrite1({1});\n"
						}],
					["w",
						"set camera shutter %d.bluePorts as %d.shutter",
						"runShutter",
						"Port1",
						"Press",
						{
							"loop": "",
							"def": "MeShutter shutter_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}{d1}",
							"work": "shutter_{0}.setState({1});\n"
						}],
					["w",
						"set mini fan %d.fanPorts blow %d.fan",
						"runFan",
						"Port1",
						"clockwise",
						{
							"loop": "",
							"def": "MePort dc130({0});\n--separator--void dc130_run( uint8_t port, int8_t direction) \n{\n pinMode(dc130.pin1(),OUTPUT);\n pinMode(dc130.pin2(),OUTPUT);\n if( direction > 0)\n {\n digitalWrite(dc130.pin2(),0);\n digitalWrite(dc130.pin1(),1);\n }\n else if( direction < 0)\n {\n digitalWrite(dc130.pin1(),0);\n digitalWrite(dc130.pin2(),1);\n }\n else\n {\n digitalWrite(dc130.pin1(),0);\n digitalWrite(dc130.pin2(),0);\n }\n}\n",
							"setup": "",
"inc": "",
							"encode": "{d0}{d1}",
							"work": "dc130_run({0},{1});\n"
						}],
					["-"],
					["R",
						"light sensor %d.laport",
						"getLightSensor",
						"light sensor on board",
						{
							"loop": "",
							"def": "MeLightSensor lightsensor_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}",
							"work": "lightsensor_{0}.read()"
						}],
					["h", "when on board button %m.button_state", "whenButtonPressed", "pressed"],
					["B",
						"on board button %m.button_state",
						"getButtonOnBoard",
						"pressed",
						{
							"loop": "",
							"def": "",
							"setup": "pinMode(A7,INPUT);\n",
							"inc": "",
							"encode": "{n7}{d0}",
							"work": "({0}^(analogRead(A7)>10?0:1))"
						}],
					["-"],
					["R",
						"ultrasonic sensor %d.whitePorts distance",
						"getUltrasonic",
						"Port3",
						{
							"loop": "",
							"def": "MeUltrasonicSensor ultrasonic_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}",
							"work": "ultrasonic_{0}.distanceCm()"
						}],
					["R",
						"line follower %d.bluePorts",
						"getLinefollower",
						"Port2",
						{
							"loop": "",
							"def": "MeLineFollower linefollower_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}",
							"work": "linefollower_{0}.readSensors()"
						}],
					["B",
						"line follower %d.bluePorts %d.leftRight is %d.whiteBlack",
						"getLinefollowerStatus",
						"Port2",
						"leftSide",
						"black",
						{
							"loop": "",
							"def": "MeLineFollower linefollower_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}{d1}{d2}",
							"work": "(true&&({2}?(linefollower_{0}.readSensors()&{1}):!(linefollower_{0}.readSensors()&{1})))"
						}],
					["R",
						"joystick %d.blackPorts %d.Axis",
						"getJoystick",
						"Port3",
						"X-Axis",
						{
							"loop": "",
							"def": "MeJoystick joystick_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}{d1}",
							"work": "joystick_{0}.read({1})"
						}],
					["R",
						"potentiometer %d.blackPorts",
						"getPotentiometer",
						"Port3",
						{
							"loop": "",
							"def": "MePotentiometer potentiometer_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}",
							"work": "potentiometer_{0}.read()"
						}],
					["R",
						"sound sensor %d.soundPort",
						"getSoundSensor",
						"Port3",
						{
							"loop": "",
							"def": "MeSoundSensor soundsensor_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}",
							"work": "soundsensor_{0}.strength()"
						}],
					["B",
						"limit switch %d.normalPort %d.slot",
						"getLimitswitch",
						"Port1",
						"Slot1",
						{
							"loop": "",
							"def": "MeLimitSwitch sw_{0}_{1}({0},{1});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}{d1}",
							"work": "sw_{0}_{1}.touched()"
						}],
					["R",
						"temperature %d.normalPort%d.slot °C",
						"getTemperature",
						"Port3",
						"Slot1",
						{
							"loop": "",
							"def": "MeTemperature temperature_{0}_{1}({0},{1});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}{d1}",
							"work": "temperature_{0}_{1}.temperature()"
						}],
					["B",
						"pir motion sensor %d.bluePorts",
						"getPirmotion",
						"Port2",
						{
							"loop": "",
							"def": "MePIRMotionSensor pir_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}",
							"work": "pir_{0}.isHumanDetected()"
						}],
					["R",
						"3-axis gyro %d.GyroAxis angle",
						"getGyro",
						"X-Axis",
						{
							"loop": "gyro.update();\n",
							"def": "MeGyro gyro;\n",
							"setup": "gyro.begin();\n",
							"inc": "",
							"encode": "{d0}",
							"work": "gyro.getAngle({0})"
						}],
					["R",
						"humiture sensor %d.normalPort %d.humiture",
						"getHumiture",
						"Port1",
						"humidity",
						{
							"loop": "humiture_{0}.update();\n",
							"def": "MeHumiture humiture_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "",
							"work": "humiture_{0}.getValue({1})"
						}],
					["R",
						"flame sensor %d.blackPorts",
						"getFlame",
						"Port3",
						{
							"loop": "",
							"def": "MeFlameSensor flameSensor_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "",
							"work": "flameSensor_{0}.readAnalog()"
						}],
					["R",
						"gas sensor %d.blackPorts",
						"getGas",
						"Port3",
						{
							"loop": "",
							"def": "MeGasSensor gasSensor_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "",
							"work": "gasSensor_{0}.readAnalog()"
						}],
					["R",
						"compass sensor %d.whitePorts",
						"gatCompass",
						"Port1",
						{
							"loop": "",
							"def": "MeCompass compass_{0}({0});\n",
							"setup": "compass_{0}.begin();\n",
							"inc": "",
							"encode": "",
							"work": "compass_{0}.getAngle()"
						}],
					["B",
						"touch sensor %d.bluePorts",
						"getTouchSensor",
						"Port1",
						{
							"loop": "",
							"def": "MeTouchSensor touchSensor_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}",
							"work": "touchSensor_{0}.touched()"
						}],
					["B",
						"button %d.blackPorts %m.button_key pressed",
						"getButton",
						"Port3",
						"key1",
						{
							"loop": "buttonSensor_{0}.pressed();",
							"def": "Me4Button buttonSensor_{0}({0});\n",
							"setup": "",
							"inc": "",
							"encode": "{d0}",
							"work": "(buttonSensor_{0}.pressed()=={1})"
						}],
					["-"],
					["B",
						"ir remote %m.ircode pressed",
						"getIrRemote",
						"A",
						{
							"loop": "ir.loop();\n",
							"def": "MeIR ir;\n",
							"setup": "ir.begin();\n",
							"inc": "",
							"encode": "{n0}{d0}",
							"work": "ir.keyPressed({0})"
						}],
					["-"],
					["w",
						"send mBot's message %s",
						"runIR",
						"hello",
						{
							"loop": "",
							"def": "MeIR ir;\n",
							"setup": "ir.begin();\n",
							"inc": "",
							"encode": "{m0}",
							"work": "ir.sendString({0});\n"
						}],
					["R",
						"mBot's message received",
						"getIR",
						{
							"loop": "",
							"def": "MeIR ir;\n",
							"setup": "ir.begin();\n",
							"inc": "",
							"encode": "{n0}",
							"work": "ir.getString()"
						}],
					["-"],
					["R",
						"timer",
						"getTimer",
						"0",
						{
							"loop": "",
							"def": "double currentTime = 0;\ndouble lastTime = 0;\n--separator--double getLastTime(){\n\treturn currentTime = millis()\/1000.0 - lastTime;\n}\n",
							"setup": "",
							"inc": "",
							"encode": "{n0}",
							"work": "getLastTime()"
						}],
					["w",
						"reset timer",
						"resetTimer",
						"0",
						{
							"loop": "",
							"def": "double currentTime = 0;\ndouble lastTime = 0;\n",
							"setup": "",
							"inc": "",
							"encode": "{n0}",
							"work": "lastTime = millis()\/1000.0;\n"
						}]],
				"extensionName": "mBot",
				"javascriptURL": "js\/mbot.js"
			}]
	}
}
0.png
1.svg
 
 
 
 
2.svg
 
 
 
 
 
 
3.png
0.wav

Teste o Premium para desbloquear

Aproveite todos os benefícios por 3 dias sem pagar! 😉
Já tem cadastro?

Continue navegando