-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Examples with the LED matrix and push button
- Loading branch information
brjapon
committed
Feb 6, 2018
1 parent
4ea5c33
commit c8ebc22
Showing
10 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"04-05 mBot sonrie","description":"","videoUrl":"","code":"/*** Included libraries ***/\n#include <BitbloqMBot.h>\n#include <BitbloqMeLEDMatrix.h>\n#include <BitbloqUS.h>\n\n\n/*** Global variables and function definition ***/\nBitbloqMBot robot;\nBitbloqMeLEDMatrix MatrizLEDS( BitbloqMCore::ports[1][1], BitbloqMCore::ports[1][2]);\nconst int sensor_de_sonido = BitbloqMCore::ports[4][2];\nBitbloqUltrasound ultrasonidos( BitbloqMCore::ports[3][2], BitbloqMCore::ports[3][2]);\nconst int siguelineas_1 = BitbloqMCore::ports[2][1];\nconst int siguelineas_2 = BitbloqMCore::ports[2][2];\n\n/*\n04-05 mBot sonrie\n*/\n\n\n\n/*** Setup ***/void setup(){\npinMode(sensor_de_sonido, INPUT);\npinMode(siguelineas_1 , INPUT);\npinMode(siguelineas_2 , INPUT);\nrobot.setup();\nMatrizLEDS.setup();\nMatrizLEDS.setBrightness(6);\nMatrizLEDS.setColorIndex(1);\nultrasonidos.setup();\n\n}\n\n\n/*** Loop ***/void loop(){MatrizLEDS.draw(0x0,0x0,0x0,0x2,0x2,0x3,0x43,0xc3,0xc3,0x43,0x3,0x2,0x2,0x0,0x0,0x0);\nwhile (ultrasonidos.readDistanceInCM() > 30){}\nMatrizLEDS.draw(0x0,0x0,0x0,0x6,0x6,0x5,0x45,0xc5,0xc5,0x45,0x5,0x6,0x6,0x0,0x0,0x0);\ndelay(100);\nMatrizLEDS.draw(0x0,0x0,0xc,0xa,0xa,0x9,0x49,0xc9,0xc9,0x49,0x9,0xa,0xa,0xc,0x0,0x0);\ndelay(100);\nMatrizLEDS.draw(0x0,0x18,0x14,0x12,0xa,0x9,0x49,0xc9,0xc9,0x49,0x9,0xa,0x12,0x14,0x18,0x0);\ndelay(1000);\n}\n\n\n\n\n","codeProject":false,"bitbloqConnectBT":null,"useBitbloqConnect":false,"image":"default","userTags":[],"hardwareTags":["mcore","mkb_ledmatrix","mkb_soundsensor","mkb_ultrasound","mkb_linefollower","mbot"],"software":{"vars":{"name":"varsBloq","content":[[]],"enable":true,"childs":[{"name":"comment","content":[[{"alias":"multilineCommentInput","id":"COMMENT","value":"04-05 mBot sonrie"}]],"enable":true}]},"setup":{"name":"setupBloq","content":[[]],"enable":true,"childs":[]},"loop":{"name":"loopBloq","content":[[]],"enable":true,"childs":[{"name":"mBotLedMatrix","content":[[{"alias":"dotsMatrix","id":"DRAW","value":"0x0,0x0,0x0,0x2,0x2,0x3,0x43,0xc3,0xc3,0x43,0x3,0x2,0x2,0x0,0x0,0x0"},{"alias":"dynamicDropdown","id":"LEDMATRIX","value":"MatrizLEDS"}]],"enable":true},{"name":"while","content":[[{"alias":"bloqInput","bloqInputId":"ARG1","value":{"name":"mBotGetDistance-v2","content":[[{"alias":"dynamicDropdown","id":"ULTRASOUND","value":"ultrasonidos"},{"alias":"staticDropdown","id":"MAGNITUDE","value":"cm"}]],"enable":true}},{"alias":"staticDropdown","id":"OPERATOR","value":">"},{"alias":"bloqInput","bloqInputId":"ARG2","value":{"name":"number","content":[[{"alias":"numberInput","id":"VALUE","value":"30"}]],"enable":true}}]],"enable":true,"childs":[]},{"name":"mBotLedMatrix","content":[[{"alias":"dotsMatrix","id":"DRAW","value":"0x0,0x0,0x0,0x6,0x6,0x5,0x45,0xc5,0xc5,0x45,0x5,0x6,0x6,0x0,0x0,0x0"},{"alias":"dynamicDropdown","id":"LEDMATRIX","value":"MatrizLEDS"}]],"enable":true},{"name":"wait","content":[[{"alias":"numberInput","id":"TIME","value":"100"}]],"enable":true},{"name":"mBotLedMatrix","content":[[{"alias":"dotsMatrix","id":"DRAW","value":"0x0,0x0,0xc,0xa,0xa,0x9,0x49,0xc9,0xc9,0x49,0x9,0xa,0xa,0xc,0x0,0x0"},{"alias":"dynamicDropdown","id":"LEDMATRIX","value":"MatrizLEDS"}]],"enable":true},{"name":"wait","content":[[{"alias":"numberInput","id":"TIME","value":"100"}]],"enable":true},{"name":"mBotLedMatrix","content":[[{"alias":"dotsMatrix","id":"DRAW","value":"0x0,0x18,0x14,0x12,0xa,0x9,0x49,0xc9,0xc9,0x49,0x9,0xa,0x12,0x14,0x18,0x0"},{"alias":"dynamicDropdown","id":"LEDMATRIX","value":"MatrizLEDS"}]],"enable":true},{"name":"wait","content":[[{"alias":"numberInput","id":"TIME","value":"1000"}]],"enable":true}]}},"hardware":{"showRobotImage":"mbot","robot":null,"board":"mcore","connections":[{"pinSourceUid":"6a23caef-6bbd-43ca-b2aa-45bfe9207218","pinTargetUid":"mcore-yellowBlueBlackWhite-3"},{"pinSourceUid":"e739d406-906d-4153-9d45-b8e6aba46c25","pinTargetUid":"mcore-yellowBlueWhite-1"},{"pinSourceUid":"85a298a5-30fe-4f12-bffb-4f6f24dea5ff","pinTargetUid":"mcore-yellowBlueBlackWhite-4"},{"pinSourceUid":"cc03d57d-2d32-4ef2-9041-e0edbaef78f5","pinTargetUid":"mcore-yellowBlueWhite-2"}],"components":[{"connected":true,"integratedComponent":true,"uid":"mkb-mcore-button","pin":{"s":"A7"},"name":"boton_de_la_placa","id":"mkb_integrated_analogPinButton","__v":0,"pins":{"digital":["s"]},"dataReturnType":"float","height":0,"width":0,"type":"mkb_integrated_analogPinButton","category":"sensors","manufacturer":"makeblock","uuid":"mkb_integrated_analogPinButton","createdAt":"2017-05-03T10:00:25.533Z","updatedAt":"2017-05-03T10:00:25.533Z","_id":"5909aa3907d51200181d4de0"},{"connected":true,"integratedComponent":true,"uid":"mkb-mcore-ldrs","pin":{"s":0},"name":"sensor_de_luz_de_la_placa","id":"mkb_integrated_lightsensor","__v":0,"pins":{"digital":["s"]},"dataReturnType":"float","height":0,"width":0,"type":"mkb_integrated_lightsensor","category":"mkb_lightsensor","manufacturer":"makeblock","uuid":"mkb_integrated_lightsensor","createdAt":"2017-05-03T10:00:25.535Z","updatedAt":"2017-05-03T10:00:25.535Z","_id":"5909aa3907d51200181d4de1"},{"connected":true,"integratedComponent":true,"uid":"mkb-mcore-RGBled-0","pin":{"s":0},"name":"ambos leds","id":"mkb_integrated_RGB","__v":0,"pins":{"digital":["s"]},"height":0,"width":0,"type":"mkb_integrated","category":"mkb_integrated_RGB","manufacturer":"makeblock","uuid":"mkb_integrated_RGB","createdAt":"2017-05-03T10:00:25.536Z","updatedAt":"2017-05-03T10:00:25.536Z","_id":"5909aa3907d51200181d4de3"},{"connected":true,"integratedComponent":true,"uid":"mkb-mcore-RGBled-1","pin":{"s":1},"name":"el led derecho","id":"mkb_integrated_RGB","__v":0,"pins":{"digital":["s"]},"height":0,"width":0,"type":"mkb_integrated","category":"mkb_integrated_RGB","manufacturer":"makeblock","uuid":"mkb_integrated_RGB","createdAt":"2017-05-03T10:00:25.536Z","updatedAt":"2017-05-03T10:00:25.536Z","_id":"5909aa3907d51200181d4de3"},{"connected":true,"integratedComponent":true,"uid":"mkb-mcore-RGBled-2","pin":{"s":2},"name":"el led izquierdo","id":"mkb_integrated_RGB","__v":0,"pins":{"digital":["s"]},"height":0,"width":0,"type":"mkb_integrated","category":"mkb_integrated_RGB","manufacturer":"makeblock","uuid":"mkb_integrated_RGB","createdAt":"2017-05-03T10:00:25.536Z","updatedAt":"2017-05-03T10:00:25.536Z","_id":"5909aa3907d51200181d4de3"},{"connected":true,"integratedComponent":true,"uid":"mkb-mcore-buzz","pin":{"s":8},"name":"zumbador_de_la_placa","id":"mkb_integrated_buzz","__v":0,"pins":{"digital":["s"]},"height":0,"width":0,"category":"mkb_integrated_buzz","manufacturer":"makeblock","uuid":"mkb_integrated_buzz","createdAt":"2017-05-03T10:00:25.535Z","updatedAt":"2017-05-03T10:00:25.535Z","_id":"5909aa3907d51200181d4de2"},{"endpoints":{"s":{"uid":"e739d406-906d-4153-9d45-b8e6aba46c25","type":"blue"}},"pin":{"s":"1"},"uid":"24428109-64b7-441e-aae1-2db767ae7a38","connected":true,"name":"MatrizLEDS","coordinates":{"x":25.464834276475344,"y":14.638157894736842},"pins":{"blue":["s"]},"metadata":{"columns":16,"rows":8},"height":125,"width":130,"manufacturer":"makeblock","type":"analog","category":"ledMatrix","uuid":"mkb_ledmatrix","createdAt":"2017-05-03T10:00:25.528Z","updatedAt":"2017-05-03T10:00:25.528Z","_id":"5922c2e87ae53c1c8abb5ae7"},{"_id":"5926df13b932a733a3bb8e48","uuid":"mkb_soundsensor","category":"mkb_soundsensor","type":"analog","manufacturer":"makeblock","width":84.5,"height":155.22,"dataReturnType":"float","pins":{"black":["s"]},"coordinates":{"x":27.162489894907033,"y":47.03947368421053},"name":"sensor_de_sonido","connected":true,"uid":"5634566c-215b-4241-9924-6c0f79c05c7d","pin":{"s":"4"},"endpoints":{"s":{"uid":"85a298a5-30fe-4f12-bffb-4f6f24dea5ff","type":"black"}}},{"_id":"5909aa3907d51200181d4ddf","updatedAt":"2017-05-03T10:00:25.532Z","createdAt":"2017-05-03T10:00:25.532Z","uuid":"mkb_ultrasound","category":"mkb_ultrasound","manufacturer":"makeblock","width":134.5,"height":106.2,"dataReturnType":"float","pins":{"yellow":["s"]},"__v":0,"coordinates":{"x":65.80436540016169,"y":55.5921052631579},"name":"ultrasonidos","connected":true,"uid":"ef286f82-d195-4474-985c-f9533e161126","pin":{"s":"3"},"endpoints":{"s":{"uid":"6a23caef-6bbd-43ca-b2aa-45bfe9207218","type":"yellow"}}},{"_id":"5909aa3907d51200181d4dde","updatedAt":"2017-05-03T10:00:25.530Z","createdAt":"2017-05-03T10:00:25.530Z","uuid":"mkb_linefollower","category":"mkb_linefollower","manufacturer":"makeblock","type":"mkb_linefollower","width":84.5,"height":128,"dataReturnType":"float","pins":{"blue":["s"]},"__v":0,"coordinates":{"x":66.53193209377525,"y":17.598684210526315},"name":"siguelineas","connected":true,"uid":"3ab5a1fa-b58c-4d4b-9eb2-a65a4ca7feee","pin":{"s":"2"},"endpoints":{"s":{"uid":"cc03d57d-2d32-4ef2-9041-e0edbaef78f5","type":"blue"}}}]},"defaultTheme":"infotab_option_grayTheme","timesDownload":0,"timesAdded":0,"timesViewed":0,"bloqsVersion":"^0.13.2"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*** Included libraries ***/ | ||
#include <BitbloqMBot.h> | ||
#include <BitbloqMeLEDMatrix.h> | ||
#include <BitbloqUS.h> | ||
|
||
|
||
/*** Global variables and function definition ***/ | ||
BitbloqMBot robot; | ||
BitbloqMeLEDMatrix MatrizLEDS( BitbloqMCore::ports[1][1], BitbloqMCore::ports[1][2]); | ||
const int sensor_de_sonido = BitbloqMCore::ports[4][2]; | ||
BitbloqUltrasound ultrasonidos( BitbloqMCore::ports[3][2], BitbloqMCore::ports[3][2]); | ||
const int siguelineas_1 = BitbloqMCore::ports[2][1]; | ||
const int siguelineas_2 = BitbloqMCore::ports[2][2]; | ||
|
||
/* | ||
04-05 mBot sonrie | ||
*/ | ||
|
||
|
||
|
||
/*** Setup ***/void setup(){ | ||
pinMode(sensor_de_sonido, INPUT); | ||
pinMode(siguelineas_1 , INPUT); | ||
pinMode(siguelineas_2 , INPUT); | ||
robot.setup(); | ||
MatrizLEDS.setup(); | ||
MatrizLEDS.setBrightness(6); | ||
MatrizLEDS.setColorIndex(1); | ||
ultrasonidos.setup(); | ||
|
||
} | ||
|
||
|
||
/*** Loop ***/void loop(){MatrizLEDS.draw(0x0,0x0,0x0,0x2,0x2,0x3,0x43,0xc3,0xc3,0x43,0x3,0x2,0x2,0x0,0x0,0x0); | ||
while (ultrasonidos.readDistanceInCM() > 30){} | ||
MatrizLEDS.draw(0x0,0x0,0x0,0x6,0x6,0x5,0x45,0xc5,0xc5,0x45,0x5,0x6,0x6,0x0,0x0,0x0); | ||
delay(100); | ||
MatrizLEDS.draw(0x0,0x0,0xc,0xa,0xa,0x9,0x49,0xc9,0xc9,0x49,0x9,0xa,0xa,0xc,0x0,0x0); | ||
delay(100); | ||
MatrizLEDS.draw(0x0,0x18,0x14,0x12,0xa,0x9,0x49,0xc9,0xc9,0x49,0x9,0xa,0x12,0x14,0x18,0x0); | ||
delay(1000); | ||
} | ||
|
||
|
||
|
||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.