lester 0 Posted November 19, 2020 Share Posted November 19, 2020 Hello, I'm trying to connect the VL6180X sensor with the MSP-EXP430G2ET using I2C and Energia but it doesn't work. I'm using the Adafruit library for arduino. I have tested the code with arduino and it works perfectly. Does somebody knows why it could be? Thank you #include <Wire.h> #include "Adafruit_VL6180X.h" Adafruit_VL6180X vl = Adafruit_VL6180X(); void setup() { Serial.begin(9600); // wait for serial port to open on native usb devices while (!Serial) { delay(1); } Serial.println("Adafruit VL6180x test!"); if (! vl.begin()) { Serial.println("Failed to find sensor"); while (1); } Serial.println("Sensor found!"); } void loop() { float lux = vl.readLux(VL6180X_ALS_GAIN_5); Serial.print("Lux: "); Serial.println(lux); uint8_t range = vl.readRange(); uint8_t status = vl.readRangeStatus(); if (status == VL6180X_ERROR_NONE) { Serial.print("Range: "); Serial.println(range); } // Some error occurred, print it out! if ((status >= VL6180X_ERROR_SYSERR_1) && (status <= VL6180X_ERROR_SYSERR_5)) { Serial.println("System error"); } else if (status == VL6180X_ERROR_ECEFAIL) { Serial.println("ECE failure"); } else if (status == VL6180X_ERROR_NOCONVERGE) { Serial.println("No convergence"); } else if (status == VL6180X_ERROR_RANGEIGNORE) { Serial.println("Ignoring range"); } else if (status == VL6180X_ERROR_SNR) { Serial.println("Signal/Noise error"); } else if (status == VL6180X_ERROR_RAWUFLOW) { Serial.println("Raw reading underflow"); } else if (status == VL6180X_ERROR_RAWOFLOW) { Serial.println("Raw reading overflow"); } else if (status == VL6180X_ERROR_RANGEUFLOW) { Serial.println("Range reading underflow"); } else if (status == VL6180X_ERROR_RANGEOFLOW) { Serial.println("Range reading overflow"); } delay(50); } Quote Link to post Share on other sites
Rei Vilo 695 Posted November 19, 2020 Share Posted November 19, 2020 Some pointers: I²C Check-List Porting an Arduino library to Energia Quote Link to post Share on other sites
StefanSch 10 Posted November 23, 2020 Share Posted November 23, 2020 Have you removed the jumper for the Red LED, they share the some port from the MSP430 and the load of the LED is to high for I2C. Also ensure your sensor board has the pull up resistors on the I2C data lines. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.