code arduino
Publié : 27 juil. 2017, 22:38
bonjour, je suis en train de suivre le tuto de sirius
http://domotique.web2diz.net/capteur-ni ... l-pour-5e/
et j'ai un probleme avec le code.
je precise tout d'abord que j'ai programmé le arduino nano en isp pour graver sur un attinny85 de la meme facon que pour "les sonde a 5euros pour les nuls v2".
j'ai posé la question a siris diectement via son site et pas de reponse a ce jour.
donc voila pour le code:
et voila les erreurs:
pour le moment, c'est juste la verification du code par l'ide qui me donne ces resultat, je nai pas encore recu les attiny ( enfin, si mais le vendeur m'a envoyé des 13a......le boulet!
a quoi estce du a votre avis?
nb, il y a des erreurs avec les autres codes de sirius aussi, et pourtant apparement, personne ne signale d'erreur....
merci de m'eclairer de vos lumieres
http://domotique.web2diz.net/capteur-ni ... l-pour-5e/
et j'ai un probleme avec le code.
je precise tout d'abord que j'ai programmé le arduino nano en isp pour graver sur un attinny85 de la meme facon que pour "les sonde a 5euros pour les nuls v2".
j'ai posé la question a siris diectement via son site et pas de reponse a ce jour.
donc voila pour le code:
Code : Tout sélectionner
/******************************************
# This script aim at reporting tack water level
# Site : http://domotique.web2diz.net/
# Detail : http://domotique.web2diz.net/?p=596
#
# License : CC BY-SA 4.0
#
# This script use the x10rf library
# See source here :
# https://github.com/p2baron/x10rf
#
#
/*******************************************/
// including x10rf library
#include <x10rf.h>
#include <avr/sleep.h>
#include <avr/wdt.h>
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
// define I/O PINS
#define SENSOR_LEVEL_0_PIN 0 // SENSOR LEVEL 0
#define SENSOR_LEVEL_1_PIN 1 // SENSOR LEVEL 1
#define SENSOR_LEVEL_2_PIN 2 // SENSOR LEVEL 2
#define SENSOR_LEVEL_3_PIN 3 // SENSOR LEVEL 3
#define RF_OUT 4 // OUTPUT RF
x10rf myx10 = x10rf(RF_OUT,0,5);
int level = 0;
volatile boolean f_wdt = 1;
// The setup
void setup() {
ADCSRA &= ~(1<<ADEN);// disable ADC (before power-off)
// SETING UP THE I/O PINS
pinMode(SENSOR_LEVEL_0_PIN, INPUT);
pinMode(SENSOR_LEVEL_1_PIN, INPUT);
pinMode(SENSOR_LEVEL_2_PIN, INPUT);
pinMode(SENSOR_LEVEL_3_PIN, INPUT);
pinMode(RF_OUT, OUTPUT);
// MYX10 INITIALIZATION
myx10.begin();
setup_watchdog(9); // approximately 8 seconds sleep
}
// The loop
void loop() {
get_and_sent_water_level();
delay(100);
// Sleep for 8 s 8 x 75 = 600 s = 10m
for (int i=0; i<75; i++){
system_sleep();
}
delay(100);
}
/*
FUNCTION
get_and_sent_water_level
*/
int get_and_sent_water_level(){
// INTERNAL PULL-UP ENABLING TO BE ABLE TO READ
digitalWrite(SENSOR_LEVEL_0_PIN, HIGH);
digitalWrite(SENSOR_LEVEL_1_PIN, HIGH);
digitalWrite(SENSOR_LEVEL_2_PIN, HIGH);
digitalWrite(SENSOR_LEVEL_3_PIN, HIGH);
delay(100);
/*
Serial.print(" LEVELLEVELLEVEL : ");
Serial.println(digitalRead(SENSOR_LEVEL_0_PIN));
Serial.print(" LEVELLEVELLEVEL : ");
Serial.println(digitalRead(SENSOR_LEVEL_1_PIN));
Serial.print(" LEVELLEVEL : ");
Serial.println(digitalRead(SENSOR_LEVEL_2_PIN));
Serial.print(" LEVEL : ");
Serial.println(digitalRead(SENSOR_LEVEL_3_PIN));
*/
int level = (1-digitalRead(SENSOR_LEVEL_0_PIN)) + (1-digitalRead(SENSOR_LEVEL_1_PIN)) + (1-digitalRead(SENSOR_LEVEL_2_PIN)) + (1-digitalRead(SENSOR_LEVEL_3_PIN)) ;
/*
Serial.print(" LEVEL OF WATER : ");
Serial.println(level);
*/
// INTERNAL PULL-UP DESABLING TO AVOID ELECTROLYSE
digitalWrite(SENSOR_LEVEL_0_PIN, LOW);
digitalWrite(SENSOR_LEVEL_1_PIN, LOW);
digitalWrite(SENSOR_LEVEL_2_PIN, LOW);
digitalWrite(SENSOR_LEVEL_3_PIN, LOW);
// SENDING THE LEVEL OVER RF
myx10.RFXmeter(12,0,level);
}
// set system into the sleep state
// system wakes up when wtchdog is timed out
void system_sleep() {
cbi(ADCSRA,ADEN); // switch Analog to Digitalconverter OFF
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
sleep_enable();
sleep_mode(); // System sleeps here
sleep_disable(); // System continues execution here when watchdog timed out
// sbi(ADCSRA,ADEN); // switch Analog to Digitalconverter ON
}
// 0=16ms, 1=32ms,2=64ms,3=128ms,4=250ms,5=500ms
// 6=1 sec,7=2 sec, 8=4 sec, 9= 8sec
void setup_watchdog(int ii) {
byte bb;
int ww;
if (ii > 9 ) ii=9;
bb=ii & 7;
if (ii > 7) bb|= (1<<5);
bb|= (1<<WDCE);
ww=bb;
MCUSR &= ~(1<<WDRF);
// start timed sequence
WDTCR |= (1<<WDCE) | (1<<WDE);
// set new watchdog timeout value
WDTCR = bb;
WDTCR |= _BV(WDIE);
}
// Watchdog Interrupt Service / is executed when watchdog timed out
ISR(WDT_vect) {
f_wdt=1; // set global flag
}
Code : Tout sélectionner
In file included from /home/vincent/Arduino/libraries/x10rf-master/x10rf.cpp:15:0:
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:25:19: error: expected ')' before 'tx_pin'
x10rf(uint8_t tx_pin, uint8_t led_pin, uint8_t rf_repeats);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:27:19: error: 'uint8_t' has not been declared
void RFXmeter(uint8_t rfxm_address, uint8_t rfxm_packet_type, long rfxm_value);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:27:41: error: 'uint8_t' has not been declared
void RFXmeter(uint8_t rfxm_address, uint8_t rfxm_packet_type, long rfxm_value);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:28:17: error: 'uint8_t' has not been declared
void RFXsensor(uint8_t rfxs_address,uint8_t rfxs_type, char rfxs_packet_type, uint8_t rfxs_value);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:28:38: error: 'uint8_t' has not been declared
void RFXsensor(uint8_t rfxs_address,uint8_t rfxs_type, char rfxs_packet_type, uint8_t rfxs_value);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:28:80: error: 'uint8_t' has not been declared
void RFXsensor(uint8_t rfxs_address,uint8_t rfxs_type, char rfxs_packet_type, uint8_t rfxs_value);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:29:34: error: 'uint8_t' has not been declared
void x10Switch(char house_code, uint8_t unit_code, uint8_t command);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:29:53: error: 'uint8_t' has not been declared
void x10Switch(char house_code, uint8_t unit_code, uint8_t command);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:30:19: error: 'uint8_t' has not been declared
void x10Security(uint8_t address, uint8_t command);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:30:36: error: 'uint8_t' has not been declared
void x10Security(uint8_t address, uint8_t command);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:33:21: error: 'uint8_t' has not been declared
void SendX10RfByte(uint8_t data);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:35:19: error: 'uint8_t' has not been declared
void SendCommand(uint8_t *date, uint8_t size);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:35:34: error: 'uint8_t' has not been declared
void SendCommand(uint8_t *date, uint8_t size);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:38:5: error: 'uint8_t' does not name a type
uint8_t _tx_pin;
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:39:5: error: 'uint8_t' does not name a type
uint8_t _led_pin;
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.h:40:2: error: 'uint8_t' does not name a type
uint8_t _rf_repeats;
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.cpp: In member function 'void x10rf::begin()':
/home/vincent/Arduino/libraries/x10rf-master/x10rf.cpp:25:10: error: '_tx_pin' was not declared in this scope
pinMode(_tx_pin, OUTPUT);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.cpp:25:19: error: 'OUTPUT' was not declared in this scope
pinMode(_tx_pin, OUTPUT);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.cpp:25:25: error: 'pinMode' was not declared in this scope
pinMode(_tx_pin, OUTPUT);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.cpp:26:6: error: '_led_pin' was not declared in this scope
if (_led_pin > 0) pinMode(_led_pin, OUTPUT);
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.cpp: At global scope:
/home/vincent/Arduino/libraries/x10rf-master/x10rf.cpp:29:13: error: expected constructor, destructor, or type conversion before '(' token
x10rf::x10rf(uint8_t tx_pin, uint8_t led_pin, uint8_t rf_repeats)
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.cpp:36:22: error: variable or field 'RFXmeter' declared void
void x10rf::RFXmeter(uint8_t rfxm_address, uint8_t rfxm_packet_type, long rfxm_value){
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.cpp:36:22: error: 'uint8_t' was not declared in this scope
/home/vincent/Arduino/libraries/x10rf-master/x10rf.cpp:36:44: error: 'uint8_t' was not declared in this scope
void x10rf::RFXmeter(uint8_t rfxm_address, uint8_t rfxm_packet_type, long rfxm_value){
^
/home/vincent/Arduino/libraries/x10rf-master/x10rf.cpp:36:70: error: expected primary-expression before 'long'
void x10rf::RFXmeter(uint8_t rfxm_address, uint8_t rfxm_packet_type, long rfxm_value){
^
Utilisation de la bibliothèque x10rf-master version 1.0.0 dans le dossier: /home/vincent/Arduino/libraries/x10rf-master
exit status 1
Erreur de compilation pour la carte ATtiny25/45/85a quoi estce du a votre avis?
nb, il y a des erreurs avec les autres codes de sirius aussi, et pourtant apparement, personne ne signale d'erreur....
merci de m'eclairer de vos lumieres