A little help with my first ever MySensors (and Arduido) sketch: Rotary Angle Sensor (knob) + Nano + esp8266 gateway
-
New error. Also is it normal that IDE recognizes nano board, but not its port?
WARNING: library GroveEncoder claims to run on [arc32] architecture(s) and may be incompatible with your current board which runs on [avr] architecture(s). encoderTest:22: error: 'Rotary' does not name a type Rotary Angle Sensor; ^ encoderTest:24: error: expected primary-expression before ',' token MyMessage msg(CHILD_ID, V_VAR1); ^ C:\Users\Vadim\Documents\Arduino\encoderTest\encoderTest.ino: In function 'void setup()': encoderTest:32: error: expected primary-expression before ',' token present(CHILD_ID, S_CUSTOM); ^ exit status 1 'Rotary' does not name a type -
It was never used in fact, and it wasn't used in a reference sketch either. removing it killed only the top error message.
-
Rotary... line before mymessage is causing problems. I think I misunderstood its meaning
#include <SPI.h> #define ROTARY_ANGLE_SENSOR A0 #define ADC_REF 5//reference voltage of ADC is 5v.If the Vcc switch on the seeeduino //board switches to 3V3, the ADC_REF should be 3.3 #define VCC 5//VCC of the grove interface is normally 5v #define FULL_ANGLE 300//full value of the rotary angle is 300 degrees // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 #define SN "RotaryAngleSensor" #define SV "1.0" #define CHILD_ID #include <MySensors.h> unsigned long SLEEP_TIME = 100; Rotary Angle Sensor; MyMessage msg(CHILD_ID, V_VAR1); int lastDegrees; void setup() { Serial.begin(9600); pinsInit(); sendSketchInfo(SN, SV); present(CHILD_ID, S_CUSTOM); } void loop() { int degrees; degrees = getDegree(); Serial.println(degrees); if (degrees != lastDegrees) { send(msg.set(degrees)); lastDegrees = degrees; } sleep(SLEEP_TIME); } void pinsInit() { pinMode(ROTARY_ANGLE_SENSOR, INPUT); } /************************************************************************/ /*Function: Get the angle between the mark and the starting position */ /*Parameter:-void */ /*Return: -int,the range of degrees is 0~300 */ int getDegree() { int sensor_value = analogRead(ROTARY_ANGLE_SENSOR); float voltage; voltage = (float)sensor_value*ADC_REF/1023; float degrees = (voltage*FULL_ANGLE)/VCC; return degrees; }``` -
Rotary... line before mymessage is causing problems. I think I misunderstood its meaning
#include <SPI.h> #define ROTARY_ANGLE_SENSOR A0 #define ADC_REF 5//reference voltage of ADC is 5v.If the Vcc switch on the seeeduino //board switches to 3V3, the ADC_REF should be 3.3 #define VCC 5//VCC of the grove interface is normally 5v #define FULL_ANGLE 300//full value of the rotary angle is 300 degrees // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 #define SN "RotaryAngleSensor" #define SV "1.0" #define CHILD_ID #include <MySensors.h> unsigned long SLEEP_TIME = 100; Rotary Angle Sensor; MyMessage msg(CHILD_ID, V_VAR1); int lastDegrees; void setup() { Serial.begin(9600); pinsInit(); sendSketchInfo(SN, SV); present(CHILD_ID, S_CUSTOM); } void loop() { int degrees; degrees = getDegree(); Serial.println(degrees); if (degrees != lastDegrees) { send(msg.set(degrees)); lastDegrees = degrees; } sleep(SLEEP_TIME); } void pinsInit() { pinMode(ROTARY_ANGLE_SENSOR, INPUT); } /************************************************************************/ /*Function: Get the angle between the mark and the starting position */ /*Parameter:-void */ /*Return: -int,the range of degrees is 0~300 */ int getDegree() { int sensor_value = analogRead(ROTARY_ANGLE_SENSOR); float voltage; voltage = (float)sensor_value*ADC_REF/1023; float degrees = (voltage*FULL_ANGLE)/VCC; return degrees; }``` -
Cascading errors (
It seems that I needencoderTest:21: error: expected primary-expression before ',' token MyMessage msg(CHILD_ID, V_VAR1); ^ C:\Users\Vadim\Documents\Arduino\encoderTest\encoderTest.ino: In function 'void setup()': encoderTest:29: error: expected primary-expression before ',' token present(CHILD_ID, S_CUSTOM); ^ exit status 1 expected primary-expression before ',' token -
Cascading errors (
It seems that I needencoderTest:21: error: expected primary-expression before ',' token MyMessage msg(CHILD_ID, V_VAR1); ^ C:\Users\Vadim\Documents\Arduino\encoderTest\encoderTest.ino: In function 'void setup()': encoderTest:29: error: expected primary-expression before ',' token present(CHILD_ID, S_CUSTOM); ^ exit status 1 expected primary-expression before ',' token -
YES, that's it, compiled and flashed... at which point the board started acting out, but I can bounce from here J
Thanks!
While we're still here, is there a way to connect 3-pin sensors (with one signal pin) to digisparks along with radio? 3-pin radio connection scheme is not an option at the moment unfortunately...
...and I feel like an idiot with a handful of those -) -
YES, that's it, compiled and flashed... at which point the board started acting out, but I can bounce from here J
Thanks!
While we're still here, is there a way to connect 3-pin sensors (with one signal pin) to digisparks along with radio? 3-pin radio connection scheme is not an option at the moment unfortunately...
...and I feel like an idiot with a handful of those -) -
I nwas about talking about digispark (attiny85) board that would be a good match for rolling out mysensors if only had a couple more pins:

I was asking if it's possible to use them after all one way or another, at least for basic sensors with 3 pins (GND, Vcc, Signal) from which we need only Signal.
I also mentioned this as known, but unwated solution:
https://www.hackster.io/arjun/nrf24l01-with-attiny85-3-pins-74a1f2