Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot:examples:matrix [2020/03/23 12:33] heikopikneren:iot:examples:matrix [Unknown date] (current) – external edit (Unknown date) 127.0.0.1
Line 4: Line 4:
  
 Needed libraries: Needed libraries:
-<code>lib_deps = ITTIoT@1.0.5, WEMOS Matrix Adafruit GFX@1.3, Adafruit GFX Library@1.7.2</code>+<code>lib_deps = WEMOS Matrix Adafruit GFX@1.3, Adafruit GFX Library@1.7.2, adafruit/Adafruit BusIO@^1.6.0</code>
  
 For learning how to use the IoT Matrix you can try out the example and tasks. For learning how to use the IoT Matrix you can try out the example and tasks.
Line 13: Line 13:
 // Librarys that the IoT Matrix uses // Librarys that the IoT Matrix uses
 #include <Arduino.h> #include <Arduino.h>
-#include <ittiot.h> 
 #include <Adafruit_GFX.h> #include <Adafruit_GFX.h>
 #include <WEMOS_Matrix_GFX.h> #include <WEMOS_Matrix_GFX.h>
 #include <SPI.h> #include <SPI.h>
 +#include <Adafruit_I2CDevice.h>
  
 MLED matrix(7); //set intensity=7 (maximum) MLED matrix(7); //set intensity=7 (maximum)
Line 23: Line 23:
   Serial.begin(9600);   Serial.begin(9600);
   Serial.println("8x8 LED Matrix Test");   Serial.println("8x8 LED Matrix Test");
- 
-  iot.printConfig(); // Print json config to serial monitor at distancelab website 
-  iot.setup(); 
- 
- 
 } }
  
 void loop() { void loop() {
- 
-  iot.handle(); 
- 
   matrix.clear(); // Clear the matrix field   matrix.clear(); // Clear the matrix field
   matrix.drawRect(0,0, 8,8, LED_ON); // Draws a empty square with positions y = 0, x = 0, y length = 8, x length = 8 and telling the leds to be on.   matrix.drawRect(0,0, 8,8, LED_ON); // Draws a empty square with positions y = 0, x = 0, y length = 8, x length = 8 and telling the leds to be on.
Line 49: Line 41:
 {{:en:iot:examples:kastid1.png?200|}} {{:en:iot:examples:kastid2.png?200|}} {{:en:iot:examples:kastid1.png?200|}} {{:en:iot:examples:kastid2.png?200|}}
  
-Tic-Tac-Toe+Trips-traps-trull
  
 <code c> <code c>
 #include <Arduino.h> #include <Arduino.h>
-#include <ittiot.h> 
 #include <Adafruit_GFX.h> #include <Adafruit_GFX.h>
 #include <WEMOS_Matrix_GFX.h> #include <WEMOS_Matrix_GFX.h>
 #include <SPI.h> #include <SPI.h>
 +#include <Adafruit_I2CDevice.h>
  
 MLED matrix(7); MLED matrix(7);
Line 63: Line 55:
   Serial.begin(9600);   Serial.begin(9600);
   Serial.println("8x8 LED Matrix Test");   Serial.println("8x8 LED Matrix Test");
- 
-  iot.printConfig(); 
-  iot.setup(); 
 } }
  
 void loop() { void loop() {
-  iot.handle(); 
   matrix.clear();   matrix.clear();
   for (int i = 0; i <= 7; i++) {   for (int i = 0; i <= 7; i++) {
Line 97: Line 85:
 {{:en:iot:examples:tripstraps.png?200|}} {{:en:iot:examples:tripstraps.png?200|}}
  
-Make everything covered one by one in a circular way+Ringiratast ekraani täitmine
  
 <code c> <code c>
 #include <Arduino.h> #include <Arduino.h>
-#include <ittiot.h> 
 #include <Adafruit_GFX.h> #include <Adafruit_GFX.h>
 #include <WEMOS_Matrix_GFX.h> #include <WEMOS_Matrix_GFX.h>
 #include <SPI.h> #include <SPI.h>
 +#include <Adafruit_I2CDevice.h>
  
 MLED matrix(7); MLED matrix(7);
Line 111: Line 99:
   Serial.begin(9600);   Serial.begin(9600);
   Serial.println("8x8 LED Matrix Test");   Serial.println("8x8 LED Matrix Test");
- 
-  iot.printConfig(); 
-  iot.setup(); 
 } }
  
-int drawRight(int a, int b, int c) {+void drawRight(int a, int b, int c) {
   for (int i = c; i <= a+c; i++) {   for (int i = c; i <= a+c; i++) {
     matrix.drawRect(i,b,1,1, LED_ON);     matrix.drawRect(i,b,1,1, LED_ON);
Line 124: Line 109:
 } }
  
-int drawDown(int a, int b) {+void drawDown(int a, int b) {
   for (int i = b; i <= a; i++) {   for (int i = b; i <= a; i++) {
     matrix.drawRect(a,i,1,1, LED_ON);     matrix.drawRect(a,i,1,1, LED_ON);
Line 132: Line 117:
 } }
  
-int drawLeft(int a, int b) {+void drawLeft(int a, int b) {
   int e = 0;   int e = 0;
   for (int i = 0; i <= a; i++) {   for (int i = 0; i <= a; i++) {
Line 142: Line 127:
 } }
  
-int drawUp(int a, int b, int c) {+void drawUp(int a, int b, int c) {
   for (int i = 0; i <= a; i++) {   for (int i = 0; i <= a; i++) {
     matrix.drawRect(c,b-i,1,1, LED_ON);     matrix.drawRect(c,b-i,1,1, LED_ON);
Line 151: Line 136:
  
 void loop() { void loop() {
-  iot.handle(); 
   matrix.clear();   matrix.clear();
   drawRight(7,0,0);   drawRight(7,0,0);
en/iot/examples/matrix.1584966831.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0