Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- dujardin
- Date:
- 2016-11-25
- Revision:
- 5:10349dda4f42
- Parent:
- 2:1af4d847d589
- Child:
- 6:edb27e228558
File content as of revision 5:10349dda4f42:
// duj401 pour TR de s2
// sans serie wdt ou autre
// lieu de programmation >>> dans le draw !!
#include "mbed.h"
#define LOW 0
#define HIGH 1
#define R 0
#define V 1
#define B 2
AnalogIn canx(PC_4);AnalogIn cany(PB_1); DigitalOut plus(PB_15); //adxl335
BusOut ABCD(PA_14,PB_0,PA_15,PC_1); // version 32/32 nucleo f401
BusOut RVB(PA_7,PA_5,PA_4,PA_1,PA_6,PA_0); // RVB ( R a droite )un seul a ecrire
DigitalOut CLK(PC_2); // Data clock - rising edge
DigitalOut LAT(PC_0); // Data latch - active low (pulse up after data load)
DigitalOut OE(PC_3); // Output enable - active low (hold high during data load, bring low after LAT pulse)
char T[32][16][4]; // Tampon affichage 4 temps R1R2V1V2B1B2 32x32 (2*16 )
char I[32][32][3]; // Y X rvb .. Image 32x32 en RVB 0 à 15 0: noir
int L; int M ; int O ; // variables globales idiotes
char J; char K ; char Q; char S ; char D; char F; // variables à la con
char G; char H ; char GG;
char T0 ; char T1 ; char T2 ; char T3;
int pt1 ; int pt2 ; int pt3 ;int pt4 ;
int dx ; int dy ; // position du 32/32 dans l'image li hi
int ax ; int ay ; int comf ; // ax offset en plus de dx et dy
char pixt ; int rr; int vv ; int bb ; // pour des couleurs
float xin; float yin; // lecture accelero
int accx ; int accy ; // acceleration
int ar; int av ; int ab ; //couleurs de dessin
int atr ; int atv ; int atb ; // couleurs du texte
int varmax; int all ;//limite maximum pour eclairage all = 1 limite temps
#include "LED.h" // gestion e/s vers matrice a led
#include "char.h" // ecriture texte
#include "draw.h" // le tableau effectue votre programme dansce draw
//***************************************************fin wdt
void init ()
{all = 0 ; // pas de limite expo
atr = 0 ; atv = 5 ; atb = 0 ; // couleur texte rouge
ar = 0 ; av = 0 ; ab = 0 ; // couleur dessin noir
dx = 0 ; dy = 0 ; // recherche adresse du tableau dans un 8*8
ax = 0 ; ay = 0; // offset a ajouter a dx et dy pour mouvement
Tr(); // efface T
Ir(); // efface I
plus = HIGH ;
}
int main()
{
init(); // initialisations importantes
//
while(1) // boucle sans fin ( temps d'execution 30 ms )
{
xin = canx.read(); yin= cany.read();
// accx = xin * 150-75; accy = yin * 150 - 75 ;
accx = xin * 1500-750; accy = yin * 1500 - 750 ; // on amplifie !
draw(); // dans draw.h c'est le lieu de votre programme en Tr
IversT(); // recharge votre image I vers T
Taffi(); // passe T vers les LEDs
Ir(); // efface le dessin dans image I
}
}