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.
Revision 8:0f4412afd3b0, committed 2021-06-08
- Comitter:
- rodrigo_vianna
- Date:
- Tue Jun 08 02:42:45 2021 +0000
- Parent:
- 7:40ce01504ad6
- Commit message:
- APS-4-SisElo-2021-1-RodrigoVianna
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 40ce01504ad6 -r 0f4412afd3b0 main.cpp
--- a/main.cpp Mon May 20 21:25:28 2019 +0000
+++ b/main.cpp Tue Jun 08 02:42:45 2021 +0000
@@ -1,12 +1,47 @@
#include "mbed.h"
-
-DigitalOut myled(LED1);
+BusOut saida(D3,D4,D5,D6);
+AnalogIn dado_analogico(A5);
+DigitalIn botao(USER_BUTTON);
+Serial pc(USBTX,USBRX);
+float valor_triangular;
+float senoide;
+int main(){
+ pc.baud(9600);
+ while(1){
+ if(botao==0){
+ for (int indice=0;indice<=15;indice++){
+ saida=indice;
+ valor_triangular = 3.3*dado_analogico.read();
+ pc.printf("\r%f\n",valor_triangular);
+ wait(0.1);
+ }
+ for (int indice=15; indice>=0; indice--){
+ saida=indice;
+ valor_triangular=3.3*dado_analogico.read();
+ pc.printf("\r%f\n", valor_triangular);
+ wait(0.1);
+ }
+ }
+ if(botao==1){
+ for (int indice=0;indice<=360;indice++){
+ saida=((sin(indice+3.14159256359/180)+1)*15)/2;
+ senoide = 3.3*dado_analogico.read();
+ pc.printf("\r%f\n",senoide);
+ wait(0.1);
+ if(botao==0){
+ break;
+ }
+ }
+ }
+ }
+ }
+
+
+
+
+
+
+
+
-int main() {
- while(1) {
- myled = 1; // LED is ON
- wait(0.5); // 200 ms
- myled = 0; // LED is OFF
- wait(3.0); // 1 sec
- }
-}
+
\ No newline at end of file