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:
- guilhemMBED
- Date:
- 2019-11-14
- Revision:
- 0:eace82fb39de
- Child:
- 1:7cd9426abb58
File content as of revision 0:eace82fb39de:
#include "mbed.h" #include "glibr.h" Serial USB_link(USBTX, USBRX); // USB initialization glibr GSensor(D4,D5); // I²C initialization : D4 = SDA ; D5 = SCL int main (void) { USB_link.baud(115200); USB_link.format(8, SerialBase::None, 1); uint16_t r=0,g=0; if (GSensor.ginit()) { USB_link.printf("APDS-9960 initialization complete\n\r"); } else { USB_link.printf("Something went wrong during APDS-9960 init\n\r"); } if(GSensor.setLEDDrive(0x00)){ // led current : 100mA USB_link.printf("led current set at 100 mA\n\r"); } else { USB_link.printf("Something went wrong during LED initialization\n\r"); } while(1) { if (GSensor.readRedLight(r)){ USB_link.printf("red value was aquired\n\r"); } else { USB_link.printf("Something went wrong during red value reading\n\r"); } USB_link.printf("red :%d\r\n",r); } return 0; }