Pages: [1]   Go Down
Author Topic: Writing code for fluxamasynth in 1.03 arduino  (Read 712 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I am working on a project with fluxamasynth, I have books on c++ and arduino.
some ression i do not have the right librarys for this code.
When I try to compile my code it says, "can not find Wprogram.h" and "byte not declared".

I am trying code like this to fix it.

Code:
#include <Fluxamasynth.h>
#include <NewSoftSerial.h>
#include <PgmChange.h>

#include <fluxamasynth_nss.h>
#include <newsoftserial.h>

#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif


Fluxamasynth synth;

#define byte uint8_t

#define c3 48          // define our notes to their midi values
#define e3 52
#define g3 55
#define c4 60

void setup()
{
  Serial.begin(9600);
  synth.setMasterVolume(100);
}

void loop()
{
  byte i=0,n=0,z=0;

  for (n=0;n<=1;n++)
  {
    for(i=0;i<=127;i++)
    {
      synth.programChange(n*127,0, i);

      Serial.print("Bank: ");
      Serial.print(n,DEC);
      Serial.print(" Sound: ");
      Serial.println(i,DEC);

      z=random(0,12);

      synth.noteOn(0, c3+z, 107);
      delay(100);
      synth.noteOn(0, e3+z, 107);
      delay(100);
      synth.noteOn(0, g3+z, 107);
      delay(100);
      synth.noteOn(0, c4+z, 107);

      delay(200);
      synth.noteOff(0, c3+z);
      synth.noteOff(0, e3+z);
      synth.noteOff(0, g3+z);
      synth.noteOff(0, c4+z);
      delay(200);
    }
  }
}


Do I need Wprogram.h at all?
I used the code
Code:
#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
« Last Edit: January 10, 2013, 05:25:50 pm by Trazman001 » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Do I need Wprogram.h at all?
That depends on which version of the IDE you are using.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It came with arduino 1.0.3

Where do I get a ide that will work?

Once arduino released 1.0 Wprogram.h was renamed as arduino.h.
« Last Edit: January 10, 2013, 06:57:09 pm by Trazman001 » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am trying code like this to fix it.
I'm going to guess that the problem isn't your sketch, but one of the libraries has not been updated for 1.0+ use. If you posted the real error messages, we could probably help.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

c:\arduino\arduino-1.0.3\libraries\Fluxamasynth/NewSoftSerial.h:7
0: error: conflicting return type specified for 'virual void
NewSoftSerial:write(uint8_t)'
C:\arduino\arduino-1.0.3\hardware\arduino\cores\arduino/Print.h:4
8: error:   overriding 'virual size_t Print::wite(uint8_t'
in file included from newtest2.ino:1:
C:\arduino\arduino-1.0.3\libraries\Fluxamasynth\Fluxamasynth.h:32
: error: 'byte' does not name a type
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

NewSoftSerial is not appropriate for use with 1.0+. Change that to SoftwareSerial, instead.

Where did you get the fluxowhatever library?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#include <SoftwareSerial.h>

#include <Fluxamasynth.h>

#include <PgmChange.h>

#include <fluxamasynth_nss.h>


#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif


Fluxamasynth synth;

#define byte uint8_t

C:\arduino\arduino-1.0.3\libraries\Fluxamasynth/Fluxamasynth.h:21
:22: error: WProgram.h: No such file or directory
in file included from
C:\arduino\arduino-1.0.3\libraries\Fluxamasynth/Fluxamasynth.h:22
,

conflicting return type specifed for 'virtual void
NewSoftSerial::write(uint8_t)'


I got the Fluxamasynth libraries from
http://wiki.moderndevice.com/pmwiki.php?n=MD.ListMethods
i couldn't get the libraries from github, no download link just printed.

Please help!  smiley-cry smiley-cry smiley-cry smiley-cry smiley-cry smiley-cry
« Last Edit: January 10, 2013, 08:28:44 pm by Trazman001 » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i couldn't get the libraries from github, no download link just printed.

I could. I don't like how they "upgraded" to 1.0+, but the latest version does compile on 1.0.1, at least.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you send me an link to the latest versions?  smiley-money
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Can you send me an link to the latest versions?
You posted it, earlier. Scroll down on that page until you see Clone in Windows followed by ZIP. Pick ZIP.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Problem solved, it compiled smiley smiley smiley smiley smiley smiley smiley smiley smiley
And uploaded!!! smiley
Thank you Paul! I feel so dumb. smiley-razz
Hey does anyone have code for fluxamasynth to make it an instrument? I need to know where to start. smiley-mr-green
« Last Edit: January 12, 2013, 01:21:47 am by Trazman001 » Logged

Pages: [1]   Go Up
Jump to: