Hello
I have found some code that i have edited and would like to use on a project that involves building a MIDI controller, using HC-Sr04 sensors. I am fairly new to coding etc and have been experiencing a few error messages. Any help with this would be awesome
the code is shown below
#include <NewPing.h>
#define SONAR_NUM 4//
#define MAX_DISTANCE 30//
#define PING_INTERVAL 33//
unsigned long pingTimer[SONAR_NUM]; //
unsigned int cm[SONAR_NUM]; //
NewPing (12, 11, MAX_DISTANCE) , //
NewPing (10, 9, MAX_DISTANC) , //
NewPing (7, 6, MAX_DISTANCE),
NewPing (4, 3 MAX_DISTANCE)
} ;
void setup () {
Serial.begin (115200) ;//
pingTimer [0] = millis () + 75;
for (uint8_t i = 1; < SONAR_NUM; i++) //
pingTimer = pingTimer (i - 1] + PING_INTERVAL ;
}
void loop () {
- for (uint8_t i = 0; i < SONAR_NUM; i++) { //*
pingTimer = pingTimer [i - 1] = PING_INTERVAL;
* }*
* void loop() {*
* for (uint8_t i = 0; i < SONAR_NUM; i ++) {//*
_ if (millis() >+ pingTimer { //_
pingTimer += PING_TERMINAL * SONAR_NUM ; //
* if (i == 0 && currentSensor == SONAR_NUM - 1) oneSensorCycle() ;
_ //_
sonar [currentSensor].timer_stop () ;
_ currentSensor = i //_
sonar[currentSensor].ping_timer(echoCheck) ;*
* }*
* }*
* }*
void echoCheck() { //
if (sonar[currentSensor].ping_result/US_ROUNDTRIP_CM;
}
void oneSensorCycle() {
* for (uint8_t i = 0; i < SONAR_NUM; i ++) {
_ serial.printIn (cm) ;*
The error message's that i receive are ;
sketch_apr20d:11: error: expected unqualified-id before numeric constant
sketch_apr20d:11: error: expected `)' before numeric constant
sketch_apr20d:15: error: expected declaration before '}' token
Any help would be brilliant,
Thanks_