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:
- rajathr
- Date:
- 2021-10-29
- Revision:
- 0:716b93ab9a58
- Child:
- 1:c125f4e65df7
File content as of revision 0:716b93ab9a58:
#include "gpio.h" #include "led1.h" #include "main_Lec9.h" //Mort: including main_Lec9.h #include "mbed.h" #include "hardware_timer.h" Serial pc(USBTX, USBRX); int main(void) { //uint32_t i,j; uint16_t countervalue; uint16_t checkvalue; //This is for first LED function //init_LED1(); //Calling the initialization function - To initialize PortB as its corresponding functionality //Mort: Do not need to say void here //This is for Output Compare: InitGPIOBPin0asOutputCompare(); TMR3CH3OutputCompare(); //This is for Input Capture: InitGPIOCPin6asInputCapture(); TMR3CH1GPIOCPin6asInputCapture(); while(true) { // Create FOR Loop to have some delay between toggling // for(i=1; i<100; i++) //Mort: Your code was fine, just your delay was too large. // { // //pc.printf("hi hi hi \n"); // j=j+1; // } //toggle_LED1(); //Function Call to toggle LED countervalue = readCounterValueIfFlagIsSet(); if (countervalue > 0 & checkvalue != countervalue) { pc.printf("\nCounter Value is = %d", countervalue); checkvalue = countervalue; } } } void debugPrint(uint32_t what) { pc.printf("The value is %u\n",what); }