diff --git a/examples/samv71_xplained_ultra/adc/main.cpp b/examples/samv71_xplained_ultra/adc/main.cpp new file mode 100644 index 0000000000..c489be3ec4 --- /dev/null +++ b/examples/samv71_xplained_ultra/adc/main.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021, Jeff McBride + * Copyright (c) 2022, Christopher Durand + * + * This file is part of the modm project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include + +using namespace modm::platform; +using namespace modm::literals; + +using Ad2 = GpioA19::Ad; // channel 0, pin AD2 on board +using Ad3 = GpioD30::Ad; // channel 8, pin AD3 on board + +int main() +{ + Board::initialize(); + + Afec0::initialize(); + Afec0::connect(); + + while (true) + { + MODM_LOG_INFO << "ADC Readings: "; + MODM_LOG_INFO.printf("%5d ", Afec0::readChannel(Afec0::getPinChannel())); + MODM_LOG_INFO.printf("%5d ", Afec0::readChannel(Afec0::getPinChannel())); + MODM_LOG_INFO << modm::endl; + + modm::delay(500ms); + } +} diff --git a/examples/samv71_xplained_ultra/adc/project.xml b/examples/samv71_xplained_ultra/adc/project.xml new file mode 100644 index 0000000000..92fcc1b682 --- /dev/null +++ b/examples/samv71_xplained_ultra/adc/project.xml @@ -0,0 +1,10 @@ + + modm:samv71-xplained-ultra + + + + + modm:build:scons + modm:platform:adc:0 + +