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: X_NUCLEO_IKA01A1 mbed
Fork of HelloWorld_IKA01A1 by
Simple test application for X-NUCLEO-IKA01A1 expansion board.
Platform compatibility issues
- NUCLEO-F302R8: use pin D5 for LED Driver configuration
- LPCXpresso11U68: use pin D3 as PWM for LED Driver configuration. Use a free Dx pin as Signal2 for Windows Comparator configuration.
main.cpp
- Committer:
- hemddabral
- Date:
- 2016-04-13
- Revision:
- 17:ae2a92af707e
- Parent:
- 16:2159a3dc888e
- Child:
- 19:a8d8f1ef04f6
File content as of revision 17:ae2a92af707e:
#include "mbed.h"
#include "x_nucleo_ika01a1_class.h"
Serial pc(USBTX, USBRX);
//Serial pc(SERIAL_TX, SERIAL_RX);
DigitalOut myled(LED1);
int main() {
X_NUCLEO_IKA01A1 *analog_expansion_board = X_NUCLEO_IKA01A1::Instance(X_NUCLEO_IKA01A1_PIN_INSTRUMENTATION_AMP,
X_NUCLEO_IKA01A1_PIN_CURRENT_SENSING,
X_NUCLEO_IKA01A1_PIN_PHOTO_SENSOR,
X_NUCLEO_IKA01A1_PIN_WINDOWS_COMP_SIGNAL_1,
X_NUCLEO_IKA01A1_PIN_WINDOWS_COMP_SIGNAL_2,
X_NUCLEO_IKA01A1_PIN_PWM_LED_DRIVER_OUTPUT,
5000);
analog_expansion_board->Init();
TSZ124 *instrAmp = analog_expansion_board->tsz124;
TSU104 *photoSensor_windComp = analog_expansion_board->tsu104;
TSV734 *led_Driver = analog_expansion_board->tsv734;
double dutyCycle = 0;
while(1) {
pc.printf("\nwhile loop\n");
unsigned int opAmpVoltage = instrAmp->GetVoltage();
unsigned int opAmpCurrent = instrAmp->GetCurrent();
// pass the analog pin name on which voltage is to be read (e.g. A3 on LPCxpresso lpc11u68)
unsigned int photoSensorVoltage = photoSensor_windComp->GetVoltage();
unsigned int windComPin1 = photoSensor_windComp->GetSignal1();
unsigned int windComPin2 = photoSensor_windComp->GetSignal2();
pc.printf("\nopAmp measured voltage(mV): %u \n", opAmpVoltage);
pc.printf("\nopAmp measured Current(mA): %u \n", opAmpCurrent);
pc.printf("\nphotodiode sensor output voltage(mV): %u \n", photoSensorVoltage);
pc.printf("\nWindows comparator: signal 1 value(pin D2): %u \n", windComPin1);
pc.printf("\nWindows comparator: signal 1 value(pin D4): %u \n", windComPin2);
dutyCycle += 0.1;
if(dutyCycle>=1)
dutyCycle -= 1;
pc.printf("\nLED Driver: duty cycle: %.2lf percent \n", led_Driver->SetDutyCycle(dutyCycle));
myled = !myled;
wait(1);
}
}

X-NUCLEO-IKA01A1 Multifunctional board based on operational amplifiers.