Hey all, can anyone help explain or have suggestions for the following
I am trying to get the Dallas Semiconductor DS18B20 temp chip to work with the Photon. The following code
compiles and works on a Core. However, when I select a Photon I get the library errors shown at the bottom.
I don’t know how to interpret the errors. Thanks.
// This #include statement was automatically added by the Spark IDE.
#include "OneWire/OneWire.h"
// This #include statement was automatically added by the Spark IDE.
#include "spark-dallas-temperature/spark-dallas-temperature.h"
#define ONE_WIRE_BUS D2 //data on pin d2
//#pragma SPARK_NO_PREPROCESSOR
double tempc=0.0;
double tempf=0.0;
int rssi =0;
OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices
DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature.
void setup(void)
{
//Serial.begin(9600);
sensors.begin(); // IC defaults to 9 bit. If you have trouble consider changing to 12.
Spark.variable("tempc", &tempc, DOUBLE); //expose vars to web interface
Spark.variable("tempf", &tempf, DOUBLE);
Spark.variable("rssi", &rssi, INT);
pinMode(7, OUTPUT);
}
void loop(void)
{
sensors.requestTemperatures(); // Send the command to get temperatures from all sensors on the one wire bus
tempc = sensors.getTempCByIndex(0); // 0 refers to the first IC on the wire
//Serial.print(tempc);
//Serial.print("C ");
tempf = (tempc * 9.0 / 5.0) + 32.0;
//Serial.print(tempf);
//Serial.print("F ");
rssi=WiFi.RSSI();
//Serial.print(rssi);
//Serial.println("dbm");
digitalWrite (7, HIGH); //quick confidence flash
delay(100);
digitalWrite (7, LOW);
delay(100);
}
OneWire/OneWire.cpp: In constructor 'OneWire::OneWire(uint16_t)':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:135:15: error: 'INPUT' was not declared in this scope
pinMode(pin, INPUT);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:135:20: error: 'pinMode' was not declared in this scope
pinMode(pin, INPUT);
^
OneWire/OneWire.cpp: In member function 'void OneWire::DIRECT_WRITE_LOW()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:142:1: error: 'PIN_MAP' was not declared in this scope
PIN_MAP[_pin].gpio_peripheral->BRR = PIN_MAP[_pin].gpio_pin;
^
OneWire/OneWire.cpp: In member function 'void OneWire::DIRECT_MODE_OUTPUT()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:146:1: error: 'GPIO_TypeDef' was not declared in this scope
GPIO_TypeDef *gpio_port = PIN_MAP[_pin].gpio_peripheral;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:146:15: error: 'gpio_port' was not declared in this scope
GPIO_TypeDef *gpio_port = PIN_MAP[_pin].gpio_peripheral;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:146:27: error: 'PIN_MAP' was not declared in this scope
GPIO_TypeDef *gpio_port = PIN_MAP[_pin].gpio_peripheral;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:149:9: error: 'GPIO_InitTypeDef' was not declared in this scope
GPIO_InitTypeDef GPIO_InitStructure;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:151:26: error: 'GPIOA' was not declared in this scope
if (gpio_port == GPIOA )
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:153:40: error: 'RCC_APB2Periph_GPIOA' was not declared in this scope
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:153:62: error: 'ENABLE' was not declared in this scope
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:153:68: error: 'RCC_APB2PeriphClockCmd' was not declared in this scope
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:155:31: error: 'GPIOB' was not declared in this scope
else if (gpio_port == GPIOB )
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:157:40: error: 'RCC_APB2Periph_GPIOB' was not declared in this scope
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:157:62: error: 'ENABLE' was not declared in this scope
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:157:68: error: 'RCC_APB2PeriphClockCmd' was not declared in this scope
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:160:5: error: 'GPIO_InitStructure' was not declared in this scope
GPIO_InitStructure.GPIO_Pin = gpio_pin;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:161:33: error: 'GPIO_Mode_Out_PP' was not declared in this scope
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:162:34: error: 'GPIO_Speed_50MHz' was not declared in this scope
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:163:30: error: 'OUTPUT' was not declared in this scope
PIN_MAP[_pin].pin_mode = OUTPUT;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:164:45: error: 'GPIO_Init' was not declared in this scope
GPIO_Init(gpio_port, &GPIO_InitStructure);
^
OneWire/OneWire.cpp: In member function 'void OneWire::DIRECT_WRITE_HIGH()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:168:1: error: 'PIN_MAP' was not declared in this scope
PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin;
^
OneWire/OneWire.cpp: In member function 'void OneWire::DIRECT_MODE_INPUT()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:172:2: error: 'GPIO_TypeDef' was not declared in this scope
GPIO_TypeDef *gpio_port = PIN_MAP[_pin].gpio_peripheral;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:172:16: error: 'gpio_port' was not declared in this scope
GPIO_TypeDef *gpio_port = PIN_MAP[_pin].gpio_peripheral;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:172:28: error: 'PIN_MAP' was not declared in this scope
GPIO_TypeDef *gpio_port = PIN_MAP[_pin].gpio_peripheral;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:175:9: error: 'GPIO_InitTypeDef' was not declared in this scope
GPIO_InitTypeDef GPIO_InitStructure;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:177:26: error: 'GPIOA' was not declared in this scope
if (gpio_port == GPIOA )
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:179:40: error: 'RCC_APB2Periph_GPIOA' was not declared in this scope
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:179:62: error: 'ENABLE' was not declared in this scope
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:179:68: error: 'RCC_APB2PeriphClockCmd' was not declared in this scope
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:181:31: error: 'GPIOB' was not declared in this scope
else if (gpio_port == GPIOB )
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:183:40: error: 'RCC_APB2Periph_GPIOB' was not declared in this scope
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:183:62: error: 'ENABLE' was not declared in this scope
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:183:68: error: 'RCC_APB2PeriphClockCmd' was not declared in this scope
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:186:5: error: 'GPIO_InitStructure' was not declared in this scope
GPIO_InitStructure.GPIO_Pin = gpio_pin;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:187:33: error: 'GPIO_Mode_IN_FLOATING' was not declared in this scope
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:188:30: error: 'INPUT' was not declared in this scope
PIN_MAP[_pin].pin_mode = INPUT;
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:189:41: error: 'GPIO_Init' was not declared in this scope
GPIO_Init(gpio_port, &GPIO_InitStructure);
^
OneWire/OneWire.cpp: In member function 'uint8_t OneWire::DIRECT_READ()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:193:30: error: 'PIN_MAP' was not declared in this scope
return GPIO_ReadInputDataBit(PIN_MAP[_pin].gpio_peripheral, PIN_MAP[_pin].gpio_pin);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:193:83: error: 'GPIO_ReadInputDataBit' was not declared in this scope
return GPIO_ReadInputDataBit(PIN_MAP[_pin].gpio_peripheral, PIN_MAP[_pin].gpio_pin);
^
OneWire/OneWire.cpp: In member function 'uint8_t OneWire::reset()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:208:15: error: 'noInterrupts' was not declared in this scope
noInterrupts();
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:210:13: error: 'interrupts' was not declared in this scope
interrupts();
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:214:22: error: 'delayMicroseconds' was not declared in this scope
delayMicroseconds(2);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:221:23: error: 'delayMicroseconds' was not declared in this scope
delayMicroseconds(480);
^
OneWire/OneWire.cpp: In member function 'void OneWire::write_bit(uint8_t)':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:235:16: error: 'noInterrupts' was not declared in this scope
noInterrupts();
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:238:23: error: 'delayMicroseconds' was not declared in this scope
delayMicroseconds(10);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:240:14: error: 'interrupts' was not declared in this scope
interrupts();
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:243:16: error: 'noInterrupts' was not declared in this scope
noInterrupts();
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:246:23: error: 'delayMicroseconds' was not declared in this scope
delayMicroseconds(65);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:248:14: error: 'interrupts' was not declared in this scope
interrupts();
^
OneWire/OneWire.cpp: In member function 'uint8_t OneWire::read_bit()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:262:15: error: 'noInterrupts' was not declared in this scope
noInterrupts();
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:265:21: error: 'delayMicroseconds' was not declared in this scope
delayMicroseconds(3);
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:269:13: error: 'interrupts' was not declared in this scope
interrupts();
^
OneWire/OneWire.cpp: In member function 'void OneWire::write(uint8_t, uint8_t)':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:288:15: error: 'noInterrupts' was not declared in this scope
noInterrupts();
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:291:13: error: 'interrupts' was not declared in this scope
interrupts();
^
OneWire/OneWire.cpp: In member function 'void OneWire::write_bytes(const uint8_t*, uint16_t, bool)':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:299:18: error: 'noInterrupts' was not declared in this scope
noInterrupts();
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:302:16: error: 'interrupts' was not declared in this scope
interrupts();
^
OneWire/OneWire.cpp: In member function 'void OneWire::depower()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:346:15: error: 'noInterrupts' was not declared in this scope
noInterrupts();
^
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:348:13: error: 'interrupts' was not declared in this scope
interrupts();
^
OneWire/OneWire.cpp: In member function 'uint8_t OneWire::DIRECT_READ()':
OneWire/OneWire.cpp:194:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make[1]: *** [../build/target/user/platform-6OneWire/OneWire.o] Error 1
make: *** [user] Error 2
Error: Could not compile. Please review your code.