![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Guide program for display oled I2C 128x64
Dependencies: mbed Adafruit_GFX
funsiones_pantalla_oled.cpp@15:bbac8ecd8bd7, 2021-07-09 (annotated)
- Committer:
- jportela
- Date:
- Fri Jul 09 01:44:09 2021 +0000
- Revision:
- 15:bbac8ecd8bd7
I created this program in order to contribute to the mbed community and anyone who is starting out in the programming of microcontrollers in mbed, besides helping those in Spanish speaking
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jportela | 15:bbac8ecd8bd7 | 1 | |
jportela | 15:bbac8ecd8bd7 | 2 | |
jportela | 15:bbac8ecd8bd7 | 3 | /********************************************************************** |
jportela | 15:bbac8ecd8bd7 | 4 | Nota: |
jportela | 15:bbac8ecd8bd7 | 5 | |
jportela | 15:bbac8ecd8bd7 | 6 | este progra es realizado por julian camilo portela gonzalez de la universidad distrital |
jportela | 15:bbac8ecd8bd7 | 7 | fransisco jose de caldas de bogota colombia. identificado con codigo estudiantil 20192573046 |
jportela | 15:bbac8ecd8bd7 | 8 | |
jportela | 15:bbac8ecd8bd7 | 9 | en este proyecto procurare hacer uso de todas las funsiones de una pantalla oled monocromatica |
jportela | 15:bbac8ecd8bd7 | 10 | usando la libreria Adafruit_GFX y Adafruit_SSD1306_I2C para la pantalla de oled de direccion 0x78 con conexion I2C con dimensiones 128 de largo y 64 de ancho |
jportela | 15:bbac8ecd8bd7 | 11 | este trabajo sera una contribucion para la comunidad de MBED y su uso libre. |
jportela | 15:bbac8ecd8bd7 | 12 | solo hare uso de las funsiones para dar una brebe explicacion de estas. |
jportela | 15:bbac8ecd8bd7 | 13 | |
jportela | 15:bbac8ecd8bd7 | 14 | para el uso de esta pantalla se uso el micro controlador STM32F411 Nucleo-64 |
jportela | 15:bbac8ecd8bd7 | 15 | **************************************************************************/ |
jportela | 15:bbac8ecd8bd7 | 16 | |
jportela | 15:bbac8ecd8bd7 | 17 | // inclujsion de librerias |
jportela | 15:bbac8ecd8bd7 | 18 | #include "mbed.h" |
jportela | 15:bbac8ecd8bd7 | 19 | #include "Adafruit_GFX.h" |
jportela | 15:bbac8ecd8bd7 | 20 | #include "Adafruit_GFX_Config.h" |
jportela | 15:bbac8ecd8bd7 | 21 | #include "Adafruit_SSD1306.h" |
jportela | 15:bbac8ecd8bd7 | 22 | #include "imagen.h" |
jportela | 15:bbac8ecd8bd7 | 23 | #include "time.h" |
jportela | 15:bbac8ecd8bd7 | 24 | |
jportela | 15:bbac8ecd8bd7 | 25 | |
jportela | 15:bbac8ecd8bd7 | 26 | |
jportela | 15:bbac8ecd8bd7 | 27 | DigitalOut myled_R(LED3); //led de HMC |
jportela | 15:bbac8ecd8bd7 | 28 | |
jportela | 15:bbac8ecd8bd7 | 29 | I2C i2c(D14,D15); // puerto de source data y puerto source cloke para el formato de coneccion I2C |
jportela | 15:bbac8ecd8bd7 | 30 | |
jportela | 15:bbac8ecd8bd7 | 31 | Adafruit_SSD1306_I2c myOled(i2c,NC,0x78,64,128); // puertos I2C, reset, nombre de la pantalla en este caso puede ser 0x78 o 0x7A, alto y ancho |
jportela | 15:bbac8ecd8bd7 | 32 | |
jportela | 15:bbac8ecd8bd7 | 33 | |
jportela | 15:bbac8ecd8bd7 | 34 | |
jportela | 15:bbac8ecd8bd7 | 35 | /* Nota: |
jportela | 15:bbac8ecd8bd7 | 36 | * el tamaño de la letra 1 da para 8 pixeles por caracter |
jportela | 15:bbac8ecd8bd7 | 37 | * el tamaño de la letra 2 da para 16 pixeles por caracter |
jportela | 15:bbac8ecd8bd7 | 38 | */ |
jportela | 15:bbac8ecd8bd7 | 39 | |
jportela | 15:bbac8ecd8bd7 | 40 | /*********************** |
jportela | 15:bbac8ecd8bd7 | 41 | nota: siempre que halla un virtual void es necesario hacer la declaracion de |
jportela | 15:bbac8ecd8bd7 | 42 | #ifdef GFX_WANT_ABSTRACTS esto en caso de ser sizetext es decir tamaño de texto |
jportela | 15:bbac8ecd8bd7 | 43 | #define GFX_SIZEABLE_TEXT |
jportela | 15:bbac8ecd8bd7 | 44 | #end if |
jportela | 15:bbac8ecd8bd7 | 45 | |
jportela | 15:bbac8ecd8bd7 | 46 | |
jportela | 15:bbac8ecd8bd7 | 47 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 48 | #define GFX_WANT_ABSTRACTS en la malloria de funsiones esta es la declaracion indicada |
jportela | 15:bbac8ecd8bd7 | 49 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 50 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 51 | #endif |
jportela | 15:bbac8ecd8bd7 | 52 | ****************/ |
jportela | 15:bbac8ecd8bd7 | 53 | |
jportela | 15:bbac8ecd8bd7 | 54 | // nota: para la explicacion del bitmap ubicarse en el archivo imagen |
jportela | 15:bbac8ecd8bd7 | 55 | |
jportela | 15:bbac8ecd8bd7 | 56 | |
jportela | 15:bbac8ecd8bd7 | 57 | |
jportela | 15:bbac8ecd8bd7 | 58 | int main() |
jportela | 15:bbac8ecd8bd7 | 59 | { |
jportela | 15:bbac8ecd8bd7 | 60 | |
jportela | 15:bbac8ecd8bd7 | 61 | // variables que se imprimen en la pantalla no necesitan convertirse a 16+ bits. |
jportela | 15:bbac8ecd8bd7 | 62 | uint16_t x=0; |
jportela | 15:bbac8ecd8bd7 | 63 | uint16_t z=0; |
jportela | 15:bbac8ecd8bd7 | 64 | uint16_t RAN=0; |
jportela | 15:bbac8ecd8bd7 | 65 | |
jportela | 15:bbac8ecd8bd7 | 66 | uint8_t pos=60; //variable para localizacion de una caracter especifico que nosotros declaremos |
jportela | 15:bbac8ecd8bd7 | 67 | |
jportela | 15:bbac8ecd8bd7 | 68 | bool af=true; //variable buleana para el uso de while |
jportela | 15:bbac8ecd8bd7 | 69 | bool tx=true; // variable buleana para el uso del texto |
jportela | 15:bbac8ecd8bd7 | 70 | int y=0; // varuiable de cambio para los if |
jportela | 15:bbac8ecd8bd7 | 71 | int w=1; // tiempo de espera general |
jportela | 15:bbac8ecd8bd7 | 72 | int w1=1; // tiempo de espera para imagenes |
jportela | 15:bbac8ecd8bd7 | 73 | |
jportela | 15:bbac8ecd8bd7 | 74 | |
jportela | 15:bbac8ecd8bd7 | 75 | // estas variables usan la funsion rand para obtener un numero alaetoreo |
jportela | 15:bbac8ecd8bd7 | 76 | |
jportela | 15:bbac8ecd8bd7 | 77 | srand (time(NULL)); // inicializa la velociadad del conteo |
jportela | 15:bbac8ecd8bd7 | 78 | |
jportela | 15:bbac8ecd8bd7 | 79 | |
jportela | 15:bbac8ecd8bd7 | 80 | int v1= (rand() % 100)/10; // v1 esta en un rango de 0 to 99 y si se divide en 10 esat a un rango de 0 a 9 |
jportela | 15:bbac8ecd8bd7 | 81 | int v2= (rand() % 100)/10; |
jportela | 15:bbac8ecd8bd7 | 82 | int v3= (rand() % 100)/10; |
jportela | 15:bbac8ecd8bd7 | 83 | int v4= v1+v2+v3; // un numero emntre 0 y 27 |
jportela | 15:bbac8ecd8bd7 | 84 | |
jportela | 15:bbac8ecd8bd7 | 85 | char C; // variable usada para dibujar una letra u numero |
jportela | 15:bbac8ecd8bd7 | 86 | |
jportela | 15:bbac8ecd8bd7 | 87 | //vector con las contantes CHAR para la funsion de DrawChar |
jportela | 15:bbac8ecd8bd7 | 88 | char L[26]={'A', 'B', 'C', 'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; |
jportela | 15:bbac8ecd8bd7 | 89 | |
jportela | 15:bbac8ecd8bd7 | 90 | myOled.begin(); // inicializo la pantalla oled |
jportela | 15:bbac8ecd8bd7 | 91 | myOled.setTextCursor (0,1); //ubicar el cursor para los textos |
jportela | 15:bbac8ecd8bd7 | 92 | |
jportela | 15:bbac8ecd8bd7 | 93 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 94 | #define GFX_SIZEABLE_TEXT |
jportela | 15:bbac8ecd8bd7 | 95 | myOled.setTextSize(2);//establece el tamaño del texto. nota explicativa al comienzo |
jportela | 15:bbac8ecd8bd7 | 96 | |
jportela | 15:bbac8ecd8bd7 | 97 | |
jportela | 15:bbac8ecd8bd7 | 98 | //imprime %u para el ancho (width) y el segundo imprime %u alto (height) |
jportela | 15:bbac8ecd8bd7 | 99 | myOled.printf("%u %u \ncuenta by julian\r\n", myOled.width(), myOled.height()); |
jportela | 15:bbac8ecd8bd7 | 100 | |
jportela | 15:bbac8ecd8bd7 | 101 | myOled.display(); //dibuja en la pantalla todas las ordenes que le hallamos otorgado |
jportela | 15:bbac8ecd8bd7 | 102 | wait(0.8); // funcion de espera o retraso |
jportela | 15:bbac8ecd8bd7 | 103 | #endif |
jportela | 15:bbac8ecd8bd7 | 104 | myOled.clearDisplay(); /// limpia la pantalla |
jportela | 15:bbac8ecd8bd7 | 105 | |
jportela | 15:bbac8ecd8bd7 | 106 | |
jportela | 15:bbac8ecd8bd7 | 107 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 108 | #define GFX_SIZEABLE_TEXT |
jportela | 15:bbac8ecd8bd7 | 109 | |
jportela | 15:bbac8ecd8bd7 | 110 | myOled.setTextSize(1); |
jportela | 15:bbac8ecd8bd7 | 111 | |
jportela | 15:bbac8ecd8bd7 | 112 | #endif |
jportela | 15:bbac8ecd8bd7 | 113 | |
jportela | 15:bbac8ecd8bd7 | 114 | while(af) |
jportela | 15:bbac8ecd8bd7 | 115 | { |
jportela | 15:bbac8ecd8bd7 | 116 | |
jportela | 15:bbac8ecd8bd7 | 117 | |
jportela | 15:bbac8ecd8bd7 | 118 | //inicia el ciclo de tiempos para trabajar |
jportela | 15:bbac8ecd8bd7 | 119 | x=0; |
jportela | 15:bbac8ecd8bd7 | 120 | RAN = v4; |
jportela | 15:bbac8ecd8bd7 | 121 | |
jportela | 15:bbac8ecd8bd7 | 122 | myOled.writeChar(pos); // se uso para indicar una posicion especifica de la pantalla oled y escribir algo concreto |
jportela | 15:bbac8ecd8bd7 | 123 | myOled.printf(" \r :3 \r"); |
jportela | 15:bbac8ecd8bd7 | 124 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 125 | |
jportela | 15:bbac8ecd8bd7 | 126 | for(int i=0; i<20; i++){ //cantidad de veces q cuenta antes de hacer alguna accion |
jportela | 15:bbac8ecd8bd7 | 127 | |
jportela | 15:bbac8ecd8bd7 | 128 | myled_R = !myled_R; //led de la placa ST |
jportela | 15:bbac8ecd8bd7 | 129 | myOled.setTextWrap(tx); // establece el modo de texto como verdadero o falso |
jportela | 15:bbac8ecd8bd7 | 130 | myOled.setTextCursor (54,20);//alinea el texto |
jportela | 15:bbac8ecd8bd7 | 131 | myOled.printf("%u\r",x);//imprime el conteo |
jportela | 15:bbac8ecd8bd7 | 132 | myOled.setTextCursor (2,2); |
jportela | 15:bbac8ecd8bd7 | 133 | myOled.setTextColor(0,1);// se usa para resaltar el texto y sus componentes son color del texto y fondo repectivamente |
jportela | 15:bbac8ecd8bd7 | 134 | // myOled.setTextColor(0); se usa para dar un color especifico al texto 1 blanco, 0 negro el cual puede confundirse tanto el texto como el fondo con este comando |
jportela | 15:bbac8ecd8bd7 | 135 | myOled.printf(" \n el numero aleatoreo es: %u\r",RAN);// imprime el numero random que carga anteriormente |
jportela | 15:bbac8ecd8bd7 | 136 | myOled.display();//imprime todas las intrucciones de la pantalla |
jportela | 15:bbac8ecd8bd7 | 137 | x = x + 1; // variable para la cuenta en pantalla |
jportela | 15:bbac8ecd8bd7 | 138 | wait(0.001); |
jportela | 15:bbac8ecd8bd7 | 139 | myOled.setTextColor(1,0); |
jportela | 15:bbac8ecd8bd7 | 140 | |
jportela | 15:bbac8ecd8bd7 | 141 | |
jportela | 15:bbac8ecd8bd7 | 142 | |
jportela | 15:bbac8ecd8bd7 | 143 | |
jportela | 15:bbac8ecd8bd7 | 144 | if(x==5){ |
jportela | 15:bbac8ecd8bd7 | 145 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 146 | myOled.setTextCursor (0,1); // indicamos a la pantalla donde iniciar a dibujar |
jportela | 15:bbac8ecd8bd7 | 147 | myOled.printf(" \nla cuenta es %u\r",z); //inicia una cuenta de ciclos |
jportela | 15:bbac8ecd8bd7 | 148 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 149 | z=z+1; // variable q se suma en pantalla cada vez que la cuanta alcanza el numero 5 |
jportela | 15:bbac8ecd8bd7 | 150 | x=0; // reinicia la varible de la cuenta a 0 |
jportela | 15:bbac8ecd8bd7 | 151 | y=y+1; |
jportela | 15:bbac8ecd8bd7 | 152 | } |
jportela | 15:bbac8ecd8bd7 | 153 | if(y==3){ |
jportela | 15:bbac8ecd8bd7 | 154 | |
jportela | 15:bbac8ecd8bd7 | 155 | // dibuja un pixel en el centro |
jportela | 15:bbac8ecd8bd7 | 156 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 157 | myOled.drawPixel(myOled.width()/2, myOled.height()/2,1); |
jportela | 15:bbac8ecd8bd7 | 158 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 159 | wait(w); // tiempo de espera antes de acabar la accion |
jportela | 15:bbac8ecd8bd7 | 160 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 161 | |
jportela | 15:bbac8ecd8bd7 | 162 | //dibuja una rectangulo con el tamaño que yo quiero |
jportela | 15:bbac8ecd8bd7 | 163 | |
jportela | 15:bbac8ecd8bd7 | 164 | #ifdef GFX_WANT_ABSTRACTS //inicia la declaracion del objeto |
jportela | 15:bbac8ecd8bd7 | 165 | #define GFX_WANT_ABSTRACTS // defino que clase de objeto es |
jportela | 15:bbac8ecd8bd7 | 166 | #define BLACK 0 //defino objetos con variable definida |
jportela | 15:bbac8ecd8bd7 | 167 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 168 | int a,l; |
jportela | 15:bbac8ecd8bd7 | 169 | a=20; |
jportela | 15:bbac8ecd8bd7 | 170 | l=20; |
jportela | 15:bbac8ecd8bd7 | 171 | myOled.drawRect((myOled.width()-a)/2, (myOled.height()-l)/2,a,l,WHITE); //punto en x, punto en y, ancho, largo y color |
jportela | 15:bbac8ecd8bd7 | 172 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 173 | #endif // termino la declaracion |
jportela | 15:bbac8ecd8bd7 | 174 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 175 | // rellena el rectangulo de la forma que yo quiera |
jportela | 15:bbac8ecd8bd7 | 176 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 177 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 178 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 179 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 180 | a=20; |
jportela | 15:bbac8ecd8bd7 | 181 | l=20; |
jportela | 15:bbac8ecd8bd7 | 182 | myOled.fillRect((myOled.width()-a)/2, (myOled.height()-l)/2,a,l, WHITE); //punto en x, punto en y, ancho, largo y color |
jportela | 15:bbac8ecd8bd7 | 183 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 184 | #endif |
jportela | 15:bbac8ecd8bd7 | 185 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 186 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 187 | |
jportela | 15:bbac8ecd8bd7 | 188 | //dibuja la ciecunferencia de un circulo ubicado donde yo quiera del radio que yo quiera |
jportela | 15:bbac8ecd8bd7 | 189 | |
jportela | 15:bbac8ecd8bd7 | 190 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 191 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 192 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 193 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 194 | myOled.drawCircle(myOled.width()/2, myOled.height()/2, 10, WHITE); |
jportela | 15:bbac8ecd8bd7 | 195 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 196 | #endif |
jportela | 15:bbac8ecd8bd7 | 197 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 198 | |
jportela | 15:bbac8ecd8bd7 | 199 | // rellena el circulo de la forma que yo quiera |
jportela | 15:bbac8ecd8bd7 | 200 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 201 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 202 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 203 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 204 | myOled.fillCircle(myOled.width()/2, myOled.height()/2, 10, WHITE); |
jportela | 15:bbac8ecd8bd7 | 205 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 206 | #endif |
jportela | 15:bbac8ecd8bd7 | 207 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 208 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 209 | |
jportela | 15:bbac8ecd8bd7 | 210 | //dibuja el perimetro de un triangulo ubicado donde yo quiera del tamaño que yo quiera |
jportela | 15:bbac8ecd8bd7 | 211 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 212 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 213 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 214 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 215 | myOled.drawTriangle(myOled.width()/2, 1, myOled.width()/4, 20,(myOled.width()*3)/4, 20, WHITE);// se agrupa por cordenada(x,y)p1, cordenada (x1,y1)p2, y cordenada (x2,y2)p3 |
jportela | 15:bbac8ecd8bd7 | 216 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 217 | #endif |
jportela | 15:bbac8ecd8bd7 | 218 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 219 | // rellena el triangulo de la forma que yo quiera |
jportela | 15:bbac8ecd8bd7 | 220 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 221 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 222 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 223 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 224 | myOled.fillTriangle((myOled.width()*3)/4,20,myOled.width()/4,20,(myOled.width())/2,1,WHITE);// para rellenar se ubica al reves los puntos cordenada (x2,y2)p3, cordenada (x1,y1)p2 y el cordenada (x,y)p1 |
jportela | 15:bbac8ecd8bd7 | 225 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 226 | #endif |
jportela | 15:bbac8ecd8bd7 | 227 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 228 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 229 | |
jportela | 15:bbac8ecd8bd7 | 230 | //dibuja la circunferencia de un circulo ubicado en un espacio que yo quiera del tamaño que yo quiera |
jportela | 15:bbac8ecd8bd7 | 231 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 232 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 233 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 234 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 235 | myOled.drawRoundRect(1,1, 40, 40, 30, WHITE);// |
jportela | 15:bbac8ecd8bd7 | 236 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 237 | #endif |
jportela | 15:bbac8ecd8bd7 | 238 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 239 | // rellena el circulo dentro del espacio del radio que yo quiera y la forma que yo quiera |
jportela | 15:bbac8ecd8bd7 | 240 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 241 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 242 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 243 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 244 | myOled.fillRoundRect(1,1,40,40,20,WHITE);// para rellenar se ubica al reves los puntos cordenada (x2,y2)p3, cordenada (x1,y1)p2 y el cordenada (x,y)p1 |
jportela | 15:bbac8ecd8bd7 | 245 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 246 | #endif |
jportela | 15:bbac8ecd8bd7 | 247 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 248 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 249 | |
jportela | 15:bbac8ecd8bd7 | 250 | //dibuja una linea con la inclinacion que yo indique |
jportela | 15:bbac8ecd8bd7 | 251 | |
jportela | 15:bbac8ecd8bd7 | 252 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 253 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 254 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 255 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 256 | myOled.drawLine(5,5,30,10,WHITE); |
jportela | 15:bbac8ecd8bd7 | 257 | |
jportela | 15:bbac8ecd8bd7 | 258 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 259 | #endif |
jportela | 15:bbac8ecd8bd7 | 260 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 261 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 262 | |
jportela | 15:bbac8ecd8bd7 | 263 | //dibuja una linea recta horizontal dede donde le indique |
jportela | 15:bbac8ecd8bd7 | 264 | |
jportela | 15:bbac8ecd8bd7 | 265 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 266 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 267 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 268 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 269 | myOled.drawFastHLine(5,5,50,WHITE); |
jportela | 15:bbac8ecd8bd7 | 270 | |
jportela | 15:bbac8ecd8bd7 | 271 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 272 | #endif |
jportela | 15:bbac8ecd8bd7 | 273 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 274 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 275 | |
jportela | 15:bbac8ecd8bd7 | 276 | //dibuja una linea recta horizontal dede donde le indique |
jportela | 15:bbac8ecd8bd7 | 277 | |
jportela | 15:bbac8ecd8bd7 | 278 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 279 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 280 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 281 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 282 | myOled.drawFastVLine(5,5,50,WHITE); |
jportela | 15:bbac8ecd8bd7 | 283 | |
jportela | 15:bbac8ecd8bd7 | 284 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 285 | #endif |
jportela | 15:bbac8ecd8bd7 | 286 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 287 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 288 | |
jportela | 15:bbac8ecd8bd7 | 289 | //rellena la pantalla con el color que quiero |
jportela | 15:bbac8ecd8bd7 | 290 | |
jportela | 15:bbac8ecd8bd7 | 291 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 292 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 293 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 294 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 295 | myOled.fillScreen(WHITE); |
jportela | 15:bbac8ecd8bd7 | 296 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 297 | #endif |
jportela | 15:bbac8ecd8bd7 | 298 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 299 | |
jportela | 15:bbac8ecd8bd7 | 300 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 301 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 302 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 303 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 304 | myOled.fillScreen(BLACK); |
jportela | 15:bbac8ecd8bd7 | 305 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 306 | #endif |
jportela | 15:bbac8ecd8bd7 | 307 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 308 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 309 | |
jportela | 15:bbac8ecd8bd7 | 310 | //dibuja una letra en la ubicacion que pongamos |
jportela | 15:bbac8ecd8bd7 | 311 | |
jportela | 15:bbac8ecd8bd7 | 312 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 313 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 314 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 315 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 316 | |
jportela | 15:bbac8ecd8bd7 | 317 | C= L[v4]; |
jportela | 15:bbac8ecd8bd7 | 318 | |
jportela | 15:bbac8ecd8bd7 | 319 | myOled.drawChar(5, 5,C,WHITE,BLACK,5); |
jportela | 15:bbac8ecd8bd7 | 320 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 321 | #endif |
jportela | 15:bbac8ecd8bd7 | 322 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 323 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 324 | |
jportela | 15:bbac8ecd8bd7 | 325 | //dibuja una imagen deacuerdo a un mapa en numeros hexdecimales |
jportela | 15:bbac8ecd8bd7 | 326 | |
jportela | 15:bbac8ecd8bd7 | 327 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 328 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 329 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 330 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 331 | /** |
jportela | 15:bbac8ecd8bd7 | 332 | se compone de ubicacion en x y ubicacion en y para comensar el trasado, |
jportela | 15:bbac8ecd8bd7 | 333 | el nombre del bitmap a dibujar previamente diseñado o llamado desde otra funcion de extencion .h, |
jportela | 15:bbac8ecd8bd7 | 334 | se otorga el alto y el ancho, luego especificamos el color de la imagen |
jportela | 15:bbac8ecd8bd7 | 335 | |
jportela | 15:bbac8ecd8bd7 | 336 | en lo posible definir el tamaño de la imagen ingresada en el archivo de la imagen y |
jportela | 15:bbac8ecd8bd7 | 337 | colocar el mismo tamaño en la funsion de drawbitmap |
jportela | 15:bbac8ecd8bd7 | 338 | **/ |
jportela | 15:bbac8ecd8bd7 | 339 | myOled.drawBitmap(0,0,myBitmap1,128,64,WHITE); |
jportela | 15:bbac8ecd8bd7 | 340 | |
jportela | 15:bbac8ecd8bd7 | 341 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 342 | #endif |
jportela | 15:bbac8ecd8bd7 | 343 | wait(w1); |
jportela | 15:bbac8ecd8bd7 | 344 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 345 | |
jportela | 15:bbac8ecd8bd7 | 346 | //-------------------------------// |
jportela | 15:bbac8ecd8bd7 | 347 | |
jportela | 15:bbac8ecd8bd7 | 348 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 349 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 350 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 351 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 352 | |
jportela | 15:bbac8ecd8bd7 | 353 | myOled.drawBitmap(0,0,myBitmap2,128,64,WHITE); |
jportela | 15:bbac8ecd8bd7 | 354 | |
jportela | 15:bbac8ecd8bd7 | 355 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 356 | #endif |
jportela | 15:bbac8ecd8bd7 | 357 | wait(w1); |
jportela | 15:bbac8ecd8bd7 | 358 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 359 | |
jportela | 15:bbac8ecd8bd7 | 360 | //----------------// |
jportela | 15:bbac8ecd8bd7 | 361 | |
jportela | 15:bbac8ecd8bd7 | 362 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 363 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 364 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 365 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 366 | |
jportela | 15:bbac8ecd8bd7 | 367 | myOled.drawBitmap(0,0,myBitmap3,128,64,WHITE); |
jportela | 15:bbac8ecd8bd7 | 368 | |
jportela | 15:bbac8ecd8bd7 | 369 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 370 | #endif |
jportela | 15:bbac8ecd8bd7 | 371 | wait(w1); |
jportela | 15:bbac8ecd8bd7 | 372 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 373 | |
jportela | 15:bbac8ecd8bd7 | 374 | //----------------// |
jportela | 15:bbac8ecd8bd7 | 375 | |
jportela | 15:bbac8ecd8bd7 | 376 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 377 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 378 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 379 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 380 | |
jportela | 15:bbac8ecd8bd7 | 381 | myOled.drawBitmap(0,0,myBitmap4,128,64,WHITE); |
jportela | 15:bbac8ecd8bd7 | 382 | |
jportela | 15:bbac8ecd8bd7 | 383 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 384 | #endif |
jportela | 15:bbac8ecd8bd7 | 385 | wait(w1); |
jportela | 15:bbac8ecd8bd7 | 386 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 387 | |
jportela | 15:bbac8ecd8bd7 | 388 | |
jportela | 15:bbac8ecd8bd7 | 389 | //-------------------------------// |
jportela | 15:bbac8ecd8bd7 | 390 | |
jportela | 15:bbac8ecd8bd7 | 391 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 392 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 393 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 394 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 395 | |
jportela | 15:bbac8ecd8bd7 | 396 | myOled.drawBitmap(0,0,myBitmap6,128,64,WHITE); |
jportela | 15:bbac8ecd8bd7 | 397 | |
jportela | 15:bbac8ecd8bd7 | 398 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 399 | #endif |
jportela | 15:bbac8ecd8bd7 | 400 | wait(w1); |
jportela | 15:bbac8ecd8bd7 | 401 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 402 | |
jportela | 15:bbac8ecd8bd7 | 403 | //----------------// |
jportela | 15:bbac8ecd8bd7 | 404 | |
jportela | 15:bbac8ecd8bd7 | 405 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 406 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 407 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 408 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 409 | |
jportela | 15:bbac8ecd8bd7 | 410 | myOled.drawBitmap(0,0,myBitmap5,124,64,WHITE); |
jportela | 15:bbac8ecd8bd7 | 411 | |
jportela | 15:bbac8ecd8bd7 | 412 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 413 | #endif |
jportela | 15:bbac8ecd8bd7 | 414 | wait(w1); |
jportela | 15:bbac8ecd8bd7 | 415 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 416 | |
jportela | 15:bbac8ecd8bd7 | 417 | /******************************** |
jportela | 15:bbac8ecd8bd7 | 418 | |
jportela | 15:bbac8ecd8bd7 | 419 | uint8_t getRotation(void); |
jportela | 15:bbac8ecd8bd7 | 420 | esta funsion lee la rotacion de una imagen q hallamos puesto y podemos ponerlo en pantalla |
jportela | 15:bbac8ecd8bd7 | 421 | ***************************************/ |
jportela | 15:bbac8ecd8bd7 | 422 | uint8_t ro; |
jportela | 15:bbac8ecd8bd7 | 423 | |
jportela | 15:bbac8ecd8bd7 | 424 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 425 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 426 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 427 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 428 | |
jportela | 15:bbac8ecd8bd7 | 429 | myOled.drawBitmap(0,0,myBitmap5,124,64,WHITE); |
jportela | 15:bbac8ecd8bd7 | 430 | |
jportela | 15:bbac8ecd8bd7 | 431 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 432 | #endif |
jportela | 15:bbac8ecd8bd7 | 433 | ro = myOled.getRotation(); |
jportela | 15:bbac8ecd8bd7 | 434 | x=ro; |
jportela | 15:bbac8ecd8bd7 | 435 | wait(w1); |
jportela | 15:bbac8ecd8bd7 | 436 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 437 | |
jportela | 15:bbac8ecd8bd7 | 438 | myOled.setTextCursor (0,1); |
jportela | 15:bbac8ecd8bd7 | 439 | myOled.printf(" \nla rotacion es %u\r",x); |
jportela | 15:bbac8ecd8bd7 | 440 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 441 | x=0; |
jportela | 15:bbac8ecd8bd7 | 442 | |
jportela | 15:bbac8ecd8bd7 | 443 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 444 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 445 | |
jportela | 15:bbac8ecd8bd7 | 446 | //funcion de rotacion de una imagen o instruccion de la pantalla |
jportela | 15:bbac8ecd8bd7 | 447 | /***************************************** |
jportela | 15:bbac8ecd8bd7 | 448 | |
jportela | 15:bbac8ecd8bd7 | 449 | para usar la funsion setRotation se usan los valores de un enum |
jportela | 15:bbac8ecd8bd7 | 450 | los cuales son 1,2,3,4 los cuales equivalen a los grados de rotacion de la pantalla |
jportela | 15:bbac8ecd8bd7 | 451 | usare esta imagen para mostrar como se hace usare el 2 |
jportela | 15:bbac8ecd8bd7 | 452 | |
jportela | 15:bbac8ecd8bd7 | 453 | |
jportela | 15:bbac8ecd8bd7 | 454 | ************************************/ |
jportela | 15:bbac8ecd8bd7 | 455 | uint8_t an=1; //90° |
jportela | 15:bbac8ecd8bd7 | 456 | myOled.setRotation(an); |
jportela | 15:bbac8ecd8bd7 | 457 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 458 | |
jportela | 15:bbac8ecd8bd7 | 459 | |
jportela | 15:bbac8ecd8bd7 | 460 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 461 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 462 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 463 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 464 | |
jportela | 15:bbac8ecd8bd7 | 465 | myOled.drawBitmap(0,0,myBitmap5,124,64,WHITE); |
jportela | 15:bbac8ecd8bd7 | 466 | |
jportela | 15:bbac8ecd8bd7 | 467 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 468 | #endif |
jportela | 15:bbac8ecd8bd7 | 469 | ro = myOled.getRotation(); |
jportela | 15:bbac8ecd8bd7 | 470 | x=ro; |
jportela | 15:bbac8ecd8bd7 | 471 | wait(w1); |
jportela | 15:bbac8ecd8bd7 | 472 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 473 | |
jportela | 15:bbac8ecd8bd7 | 474 | myOled.setTextCursor (0,1); |
jportela | 15:bbac8ecd8bd7 | 475 | myOled.printf(" \nla rotacion es %u\r",x); |
jportela | 15:bbac8ecd8bd7 | 476 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 477 | x=0; |
jportela | 15:bbac8ecd8bd7 | 478 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 479 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 480 | |
jportela | 15:bbac8ecd8bd7 | 481 | //**************// |
jportela | 15:bbac8ecd8bd7 | 482 | an=2; //180° |
jportela | 15:bbac8ecd8bd7 | 483 | myOled.setRotation(an); |
jportela | 15:bbac8ecd8bd7 | 484 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 485 | |
jportela | 15:bbac8ecd8bd7 | 486 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 487 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 488 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 489 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 490 | |
jportela | 15:bbac8ecd8bd7 | 491 | myOled.drawBitmap(0,0,myBitmap5,124,64,WHITE); |
jportela | 15:bbac8ecd8bd7 | 492 | |
jportela | 15:bbac8ecd8bd7 | 493 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 494 | #endif |
jportela | 15:bbac8ecd8bd7 | 495 | ro = myOled.getRotation(); |
jportela | 15:bbac8ecd8bd7 | 496 | x=ro; |
jportela | 15:bbac8ecd8bd7 | 497 | wait(w1); |
jportela | 15:bbac8ecd8bd7 | 498 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 499 | |
jportela | 15:bbac8ecd8bd7 | 500 | myOled.setTextCursor (0,1); |
jportela | 15:bbac8ecd8bd7 | 501 | myOled.printf(" \nla rotacion es %u\r",x); |
jportela | 15:bbac8ecd8bd7 | 502 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 503 | x=0; |
jportela | 15:bbac8ecd8bd7 | 504 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 505 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 506 | |
jportela | 15:bbac8ecd8bd7 | 507 | |
jportela | 15:bbac8ecd8bd7 | 508 | //**************// |
jportela | 15:bbac8ecd8bd7 | 509 | an=3; //270° |
jportela | 15:bbac8ecd8bd7 | 510 | myOled.setRotation(an); |
jportela | 15:bbac8ecd8bd7 | 511 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 512 | |
jportela | 15:bbac8ecd8bd7 | 513 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 514 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 515 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 516 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 517 | |
jportela | 15:bbac8ecd8bd7 | 518 | myOled.drawBitmap(0,0,myBitmap5,124,64,WHITE); |
jportela | 15:bbac8ecd8bd7 | 519 | |
jportela | 15:bbac8ecd8bd7 | 520 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 521 | #endif |
jportela | 15:bbac8ecd8bd7 | 522 | ro = myOled.getRotation(); |
jportela | 15:bbac8ecd8bd7 | 523 | x=ro; |
jportela | 15:bbac8ecd8bd7 | 524 | wait(w1); |
jportela | 15:bbac8ecd8bd7 | 525 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 526 | |
jportela | 15:bbac8ecd8bd7 | 527 | myOled.setTextCursor (0,1); |
jportela | 15:bbac8ecd8bd7 | 528 | myOled.printf(" \nla rotacion es %u\r",x); |
jportela | 15:bbac8ecd8bd7 | 529 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 530 | x=0; |
jportela | 15:bbac8ecd8bd7 | 531 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 532 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 533 | |
jportela | 15:bbac8ecd8bd7 | 534 | //**************// |
jportela | 15:bbac8ecd8bd7 | 535 | an=4; //360° |
jportela | 15:bbac8ecd8bd7 | 536 | myOled.setRotation(an); |
jportela | 15:bbac8ecd8bd7 | 537 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 538 | |
jportela | 15:bbac8ecd8bd7 | 539 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 540 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 541 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 542 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 543 | |
jportela | 15:bbac8ecd8bd7 | 544 | myOled.drawBitmap(0,0,myBitmap5,124,64,WHITE); |
jportela | 15:bbac8ecd8bd7 | 545 | |
jportela | 15:bbac8ecd8bd7 | 546 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 547 | #endif |
jportela | 15:bbac8ecd8bd7 | 548 | ro = myOled.getRotation(); |
jportela | 15:bbac8ecd8bd7 | 549 | x=ro; |
jportela | 15:bbac8ecd8bd7 | 550 | wait(w1); |
jportela | 15:bbac8ecd8bd7 | 551 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 552 | |
jportela | 15:bbac8ecd8bd7 | 553 | myOled.setTextCursor (0,1); |
jportela | 15:bbac8ecd8bd7 | 554 | myOled.printf(" \nla rotacion es %u\r",x); |
jportela | 15:bbac8ecd8bd7 | 555 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 556 | x=0; |
jportela | 15:bbac8ecd8bd7 | 557 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 558 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 559 | |
jportela | 15:bbac8ecd8bd7 | 560 | tx=false; |
jportela | 15:bbac8ecd8bd7 | 561 | |
jportela | 15:bbac8ecd8bd7 | 562 | |
jportela | 15:bbac8ecd8bd7 | 563 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 564 | myOled.setTextWrap(tx); |
jportela | 15:bbac8ecd8bd7 | 565 | myOled.setTextCursor (0,1); |
jportela | 15:bbac8ecd8bd7 | 566 | myOled.printf(" \nla cuenta es %u\r",z); |
jportela | 15:bbac8ecd8bd7 | 567 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 568 | wait(0.5); |
jportela | 15:bbac8ecd8bd7 | 569 | y=y+1; |
jportela | 15:bbac8ecd8bd7 | 570 | z=z+1; |
jportela | 15:bbac8ecd8bd7 | 571 | x=0; |
jportela | 15:bbac8ecd8bd7 | 572 | |
jportela | 15:bbac8ecd8bd7 | 573 | |
jportela | 15:bbac8ecd8bd7 | 574 | |
jportela | 15:bbac8ecd8bd7 | 575 | } |
jportela | 15:bbac8ecd8bd7 | 576 | |
jportela | 15:bbac8ecd8bd7 | 577 | if((y==5)){ |
jportela | 15:bbac8ecd8bd7 | 578 | |
jportela | 15:bbac8ecd8bd7 | 579 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 580 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 581 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 582 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 583 | myOled.fillScreen(WHITE); |
jportela | 15:bbac8ecd8bd7 | 584 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 585 | #endif |
jportela | 15:bbac8ecd8bd7 | 586 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 587 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 588 | |
jportela | 15:bbac8ecd8bd7 | 589 | myOled.printf(" \n fin"); |
jportela | 15:bbac8ecd8bd7 | 590 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 591 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 592 | y=y+1; |
jportela | 15:bbac8ecd8bd7 | 593 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 594 | |
jportela | 15:bbac8ecd8bd7 | 595 | #ifdef GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 596 | #define GFX_WANT_ABSTRACTS |
jportela | 15:bbac8ecd8bd7 | 597 | #define BLACK 0 |
jportela | 15:bbac8ecd8bd7 | 598 | #define WHITE 1 |
jportela | 15:bbac8ecd8bd7 | 599 | myOled.fillScreen(BLACK); |
jportela | 15:bbac8ecd8bd7 | 600 | myOled.display(); |
jportela | 15:bbac8ecd8bd7 | 601 | #endif |
jportela | 15:bbac8ecd8bd7 | 602 | wait(w); |
jportela | 15:bbac8ecd8bd7 | 603 | myOled.clearDisplay(); |
jportela | 15:bbac8ecd8bd7 | 604 | af=false; |
jportela | 15:bbac8ecd8bd7 | 605 | } |
jportela | 15:bbac8ecd8bd7 | 606 | |
jportela | 15:bbac8ecd8bd7 | 607 | } |
jportela | 15:bbac8ecd8bd7 | 608 | |
jportela | 15:bbac8ecd8bd7 | 609 | } |
jportela | 15:bbac8ecd8bd7 | 610 | } |
jportela | 15:bbac8ecd8bd7 | 611 |