Notifications
Clear all

Changing Library syntax??

3 Posts
2 Users
0 Likes
1,697 Views
(@davemorris)
Member
Joined: 3 years ago
Posts: 31
Topic starter  

I have been learning a lot while building my latest Arduino project and asking lots of questions that you guys smarter than I have been so gracious to answer.  Now I have another...

Is there a listing of the syntax that is used with a particular Arduino Library? Specifically I am looking for the code that works with the latest version of the Adafruit_MLX90614.h library.  My project utilizes two MLX90614 IR Temp sensors and I have successfully changed the I2C address of one of them to get both to work on my project. However, I changed the digital pin I am using for an indicator LED to another pin that was available. This is simply a PinMode line followed by a DigitalWrite line to turn on that LED.  I simply changed from one pin to a different one. When I went to upload the sketch to my project, I get an error regarding the AddrSet line.  A week ago I noticed that the Adafruit library was updated, but why did this line work before, but now it doesn't? I have looked on the Adafruit site and elsewhere and I can not find any information on what I have wrong or what would have changed.  Any ideas?

#include "Wire.h"
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1351.h"
#include "Adafruit_MLX90614.h" //modified sensor library for multiple MLX sensors

//screen dimensions
#define SCREEN_WIDTH 128 //pixel width
#define SCREEN_HEIGHT 128 //pixel height

//pin definitions
#define SCLK_PIN 7 //defines s clock pin
#define MOSI_PIN 11 //defines master-out slave-in SDA pin
#define RST_PIN 3 //defines reset pin
#define DC_PIN 5 //defines master-in slave-out pin
#define CS_PIN 4 //defines chip select pin

//color definitions
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define GREY 0x8410
#define ORANGE 0xE880

Adafruit_SSD1351 display=Adafruit_SSD1351(SCREEN_WIDTH, SCREEN_HEIGHT, &SPI, CS_PIN, DC_PIN, RST_PIN);

//IR sensor setup
#define IR1 0x5A
#define IR2 0x5B
Adafruit_MLX90614 mlx;

//code for voltage test

#define ANALOG_IN_PIN A0 //analog input pin
float adc_voltage = 0.0; //float for ADC voltage
float in_voltage = 0.0; //float for input voltage
float R1 = 30000.0; //floats for resistor values in divider
float R2 = 7500.0;
float ref_voltage = 4.096; //float for reference voltage
float adc_value = 0; //float for ADC value

void setup() {
// put your setup code here, to run once:

// Power ON indicator
pinMode(8,OUTPUT);
digitalWrite(8,HIGH);

//start I2C bus
Wire.begin();

//start IR sensors
mlx.begin();

// Use external voltage reference
analogReference(EXTERNAL);

//set up initial screen elements
display.begin();
display.fillScreen(BLACK);
display.setTextColor(ORANGE);
display.setTextSize(1);
display.setCursor(25,0);
display.print("SYSTEM STATUS");
display.setTextSize(1);
display.setCursor(0,20);
display.setTextColor(BLUE);
display.print("INPUT VOLTAGE:");
display.setCursor(0,33);
display.setTextColor(BLUE);
display.print("VXi TEMP RIGHT:");
display.setCursor(0,46);
display.setTextColor(BLUE);
display.print("VXi TEMP LEFT:");

 

}

void loop() {
// put your main code here, to run repeatedly:

//Read analog voltage input
adc_value = analogRead(ANALOG_IN_PIN);

//Determine voltage at ADC input
adc_voltage = (adc_value * ref_voltage)/1024.0;

//Calculate voltage at divider input
in_voltage = adc_voltage / (R2/(R1+R2));
String VoltNew = String(in_voltage,2);

//Draw black rectangle over voltage display to clear numbers
display.drawRect(88,20,40,10,BLACK);
display.fillRect(88,20,40,10,BLACK);

// Send voltage results to screen
display.setCursor(88,20);
display.setTextColor(WHITE);
display.print(VoltNew);
delay(1000);

//read IR sensor
mlx.AddrSet(IR1);

//Draw black rectangle over left temp display to clear numbers
display.drawRect(91,33,40,10,BLACK);
display.fillRect(91,33,40,10,BLACK);

// Send Right amp temp results to screen
display.setCursor(91,33);
display.setTextColor(WHITE);
display.print(mlx.readObjectTempF());
mlx.temp1 = mlx.readObjectTempF();
delay(100);

//read IR sensor
mlx.AddrSet(IR2);

In function 'void loop()':
Colorado:115:9: error: 'class Adafruit_MLX90614' has no member named 'AddrSet'
mlx.AddrSet(IR2);

 


   
Quote
MadMisha
(@madmisha)
Member
Joined: 4 years ago
Posts: 340
 

It sounds like you need to replace the edited library in it's place again. The original library might have updated and returned it back to the original(but possibly updated) that could not handle 2 sensors.


   
ReplyQuote
(@davemorris)
Member
Joined: 3 years ago
Posts: 31
Topic starter  

@madmisha

Ahh yes, I forgot that I loaded a modified version of the Adafruit library.  Thank you for pointing that out.


   
ReplyQuote