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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 2:6566f09256dc
- Parent:
- 1:1779a3279496
- Child:
- 3:032c516c2ffa
--- a/main.cpp Thu Aug 15 12:09:06 2019 +0000
+++ b/main.cpp Thu Aug 15 13:19:33 2019 +0000
@@ -1,33 +1,36 @@
-#include "mbed.h" // c'est une obligation
+#include "mbed.h" //
-//------------------------------------
-// configuration liaison série à 19200 bps ( driver stlink)
+//-------- exemple <toto> dans mes432 ----------------
+// chaque seconde il numérise 4 datas de A0 et A1 et joue à duj2 sans plus
+//
+// configuration liaison série à 19200 bps ( driver stlink)
// A0 et A1 sont placées en entrée analogique ( mesure sortie AOP)
// A3 et A4 sont placées en sortie analogique ( offset vers AOP)
-// led sur carte nommée LL
-// chaque seconde ce programme numérise 4 datas de A0 et A1 sans plus
-// il transfert 4 octets en duj2 (avant dernier exemple fiche duj2)
-//
+// sorties led sur carte nommée LL , IO sur D3 , pol sur D2
+// broches D0 D1 de l'I2C sont pré déclarées
//------------------------------------
+//****************** déclaration des broches ****************
Serial pc(SERIAL_TX, SERIAL_RX); // PORT SERIE SUR usb !!
AnalogIn Ch1(A0) ;AnalogIn Ch2(A1); // entrées ana nommées Ch1 Ch2
AnalogOut out1(A3);AnalogOut out2(A4); // sorties ana nommées out1 out2
I2C i2c(D0,D1); // (sda,scl) canal I2C nommé i2c
-DigitalOut S0(D2); // sortie TTL nommée S0
+DigitalOut pol(D2); // polarisation à 3.3V I2C ( si à 1)
+DigitalOut IO(D3); // sortie TTL nommée S0
DigitalOut LL(LED1); // led nommée LL ( sur module L432
-
+// nota IO peut etre déclarée en entrée en ecrivant DigitalIn IO(D3);
+//**********************************************************************
uint16_t ch1i[5]; // tableaux d' int
uint16_t ch2i[5];
-
int main()
{
- pc.baud(19200); // initialisations
- LL = 0 ;
+ pc.baud(19200); // initialisations
+ pol = 1; //on polarise l'I2C au cas ou
+ LL = 0 ; // led L432 on
out1.write(0.5); // sortie A3 = 0.5 * 3.3V soit 1.6 V
out2.write(0.25); // sortie A4 = 0.25* 3.3V soit 0.8 V
- S0 = 1 ; // sortie commande mise à 1 ou 3.3V
+ IO = 1 ; // sortie I/O commande mise à 1 ou 3.3V
while(1) // boucle sans fin
{