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: mbed
main.cpp
- Committer:
- JeongHoLee
- Date:
- 2019-01-23
- Revision:
- 0:54d71ce98029
File content as of revision 0:54d71ce98029:
#include "TPL0102.h"
TPL0102 potentiometer(PB_9, PB_8); // PB_9 SDA, PB_8 SCL
//AnalogIn analog_value(PA_0);
Serial pc(USBTX, USBRX);
int main()
{
pc.printf("Start\r\n");
if(potentiometer.SlaveSelect(0x00, 0xC0)) { pc.printf("Not written\r\n"); }
else { pc.printf("written\r\n"); }
if(potentiometer.AccessControlRegister(0x40)) { pc.printf("ACR Not written\r\n"); } // Non-volatile register, x:shutdown, read non-volatile write op.
else { pc.printf("ACR written\r\n"); }
int i=0xC0;
while(1)
{
i++;
potentiometer.SlaveSelect(0x00, i);
if(i==0xff) i=0x00;
wait(1);
}
return 0;
// pc.printf("%d\r\n", analog_value);
}