Skip to content

Instantly share code, notes, and snippets.

@xseignard
Created December 19, 2015 00:30
Show Gist options
  • Save xseignard/372722b7e24a44d119dd to your computer and use it in GitHub Desktop.
Save xseignard/372722b7e24a44d119dd to your computer and use it in GitHub Desktop.
#include <SoftwareSerial.h>
int Rx_pin = 9; // to Somo Tx
int Tx_pin = 8; // to Somo Rx
SoftwareSerial Somo(Rx_pin,Tx_pin);
// Init Somo byte stream
byte init[] = {0x7E, 0x06, 0x00, 0x00, 0x1E, 0xFF, 0xDC, 0xEF};
// Example byte stream to send to play track 001
byte track1[] = {0x7E, 0x03, 0x00, 0x00, 0x01, 0xFF, 0xFC, 0xEF};
// Example byte stream to send to play track 002
byte track2[] = {0x7E, 0x03, 0x00, 0x00, 0x02, 0xFF, 0xFB, 0xEF};
void setup() {
Somo.begin(9600);
delay(500);
Somo.write(init, sizeof(init));
delay(100);
}
void loop() {
Somo.write(track1, sizeof(track1));
delay(10000);
}
@xseignard
Copy link
Author

[Stino - Start building "somoTest2"...]
[  3%] Creating /tmp/Stino_build/somoTest2/somoTest2.ino.cpp.o...
/home/bigx/repos/lapin-lemot/arduino/somoTest2/somoTest2.ino:8:11: error: 'byte init []' redeclared as different kind of symbol
 byte init[] = {0x7E, 0x06, 0x00, 0x00, 0x1E, 0xFF, 0xDC, 0xEF};
           ^
In file included from /home/bigx/repos/lapin-lemot/arduino/somoTest2/somoTest2.ino:3:0:
/home/bigx/info/arduino-1.6.0/hardware/arduino/avr/cores/arduino/Arduino.h:120:6: error: previous declaration of 'void init()'
 void init(void);
      ^
/home/bigx/repos/lapin-lemot/arduino/somoTest2/somoTest2.ino: In function 'void setup()':
/home/bigx/repos/lapin-lemot/arduino/somoTest2/somoTest2.ino:18:30: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
  Somo.write(init, sizeof(init));
                              ^
/home/bigx/repos/lapin-lemot/arduino/somoTest2/somoTest2.ino:18:31: error: no matching function for call to 'SoftwareSerial::write(void (&)(), unsigned int)'
  Somo.write(init, sizeof(init));
                               ^
/home/bigx/repos/lapin-lemot/arduino/somoTest2/somoTest2.ino:18:31: note: candidates are:
In file included from /home/bigx/repos/lapin-lemot/arduino/somoTest2/somoTest2.ino:1:0:
/home/bigx/info/arduino-1.6.0/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.h:92:18: note: virtual size_t SoftwareSerial::write(uint8_t)
   virtual size_t write(uint8_t byte);
                  ^
/home/bigx/info/arduino-1.6.0/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.h:92:18: note:   candidate expects 1 argument, 2 provided
In file included from /home/bigx/info/arduino-1.6.0/hardware/arduino/avr/cores/arduino/Stream.h:26:0,
                 from /home/bigx/info/arduino-1.6.0/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.h:36,
                 from /home/bigx/repos/lapin-lemot/arduino/somoTest2/somoTest2.ino:1:
/home/bigx/info/arduino-1.6.0/hardware/arduino/avr/cores/arduino/Print.h:54:12: note: size_t Print::write(const char*, size_t)
     size_t write(const char *buffer, size_t size) {
            ^
/home/bigx/info/arduino-1.6.0/hardware/arduino/avr/cores/arduino/Print.h:54:12: note:   no known conversion for argument 1 from 'void()' to 'const char*'
/home/bigx/info/arduino-1.6.0/hardware/arduino/avr/cores/arduino/Print.h:53:20: note: virtual size_t Print::write(const uint8_t*, size_t)
     virtual size_t write(const uint8_t *buffer, size_t size);
                    ^
/home/bigx/info/arduino-1.6.0/hardware/arduino/avr/cores/arduino/Print.h:53:20: note:   no known conversion for argument 1 from 'void()' to 'const uint8_t* {aka const unsigned char*}'
/home/bigx/info/arduino-1.6.0/hardware/arduino/avr/cores/arduino/Print.h:49:12: note: size_t Print::write(const char*)
     size_t write(const char *str) {
            ^
/home/bigx/info/arduino-1.6.0/hardware/arduino/avr/cores/arduino/Print.h:49:12: note:   candidate expects 1 argument, 2 provided

[Stino - Exit with error code 1.]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment