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:
- MikamiUitOpen
- Date:
- 2014-11-05
- Revision:
- 1:09cc28c39f81
- Parent:
- 0:ab1c0a2028da
File content as of revision 1:09cc28c39f81:
//--------------------------------------------------------------
// Example for ADC and DAC using mbed official classes
// Copyright (c) 2014 MIKAMI, Naoki, 2014/11/05
//--------------------------------------------------------------
#include "mbed.h"
#include "myDac.hpp"
AnalogIn adc_(A0); // using mbed official class
DacA dacA_; // using hand made class
Ticker timer_; // for timer interrupt
// Timer interrupt service routine
void TimerIsr()
{
uint16_t value = adc_.read_u16(); // AD
dacA_.Write(value>>4); // DA
}
int main()
{
timer_.attach_us(&TimerIsr, 20);
while (true) {}
}