Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Playtune library on Arduino 1.0.1 on: December 24, 2013, 01:14:28 pm
What you need to do is cast away the const.

Do you mean that I should use the "const_cast" operator? I tried changing

Code:
  void tune_playscore (byte *score); // start playing a polyphonic score
to
Code:
void tune_playscore (const_cast<byte*>(*score)); // start playing a polyphonic score

but I get the same error... Since Playtune.h is a C header file, does it support the const_cast operator? (which I thought was only in C++). Any further suggestions would be appreciated!!!
2  Using Arduino / Programming Questions / Re: Playtune library on Arduino 1.0.1 on: December 23, 2013, 08:55:32 pm
The rest is too big to post so I attached them.

The modifications included in these snippets are the ones that got me this error message:
Code:
test.cpp:192:27: error: invalid conversion from ‘const byte* {aka const unsigned char*}’ to ‘byte* {aka unsigned char*}’ [-fpermissive]
In file included from test.cpp:11:0:
/home/name/arduino/libraries/Playtune/Playtune.h:42:7: error:   initializing argument 1 of ‘void Playtune::tune_playscore(byte*)’ [-fpermissive]
3  Using Arduino / Programming Questions / Re: Playtune library on Arduino 1.0.1 on: December 23, 2013, 08:52:41 pm
I meant that I changed

Code:
 void tune_playscore (byte *score); // start playing a polyphonic score
to
Code:
 void tune_playscore (const byte *score); // start playing a polyphonic score

Here is Playtune.h:
Code:
/**************************************************************************
*
* Playtune: An Arduino Tune Generator
* **********/
/*
* Change log
*  19 January 2011, L.Shustek, V1.0: Initial release.
*  10 June 2013, L. Shustek, V1.3
*     - change to be compatible with Arduino IDE version 1.0.5
*/

#ifndef Playtune_h
#define Playtune_h

#include <Arduino.h>

class Playtune
{
public:
 void tune_initchan (byte pin); // assign a timer to an output pin
 void tune_playscore (byte *score); // start playing a polyphonic score
 volatile static boolean tune_playing; // is the score still playing?
 void tune_stopscore (void); // stop playing the score
 void tune_delay (unsigned msec); // delay in milliseconds
 void tune_stopchans (void); // stop all timers
};

#endif

4  Using Arduino / Programming Questions / Playtune library on Arduino 1.0.1 on: December 23, 2013, 03:24:16 pm
When I try to compile anything using the Playtune library, I receive the following error message:

Code:
[....]/arduino/libraries/Playtune/Playtune.h:36:21: fatal error: arduino.h: No such file or directory
compilation terminated.

I did some research and determined that I should change "/avr/arduino.h" in the playtune files to "Arduino.h"--this solved the first error, but then I got another:

Code:
test.cpp:21:21: error: variable ‘score’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’

This is when I try to compile the Nano test file (downloaded from the Playtune page: https://code.google.com/p/arduino-playtune/downloads/detail?name=test_nano.pde&can=2&q=). I am using an Arduino Uno but I didn't think it would matter.

I changed the following:
Code:
byte PROGMEM score [] = {
to
Code:
const byte PROGMEM score [] = {
, which solved the initial error, but once again a new problem arose:
Code:
test.cpp:192:27: error: invalid conversion from ‘const byte* {aka const unsigned char*}’ to ‘byte* {aka unsigned char*}’ [-fpermissive]
In file included from test.cpp:11:0:
/home/name/arduino/libraries/Playtune/Playtune.h:42:7: error:   initializing argument 1 of ‘void Playtune::tune_playscore(byte*)’ [-fpermissive]

Having only a basic knowledge of C I have no real idea where to go from here... I assume the second error is referencing this:
Code:
class Playtune
{
public:
 void tune_initchan (byte pin); // assign a timer to an output pin
 void tune_playscore (byte *score); // start playing a polyphonic score

I tried adding "const" before the playscore function declaration, but that produces a new error:
Code:
/home/name/arduino/libraries/Playtune/Playtune.cpp:191:22: fatal error: playtune.h: No such file or directory
compilation terminated.

Any help would be greatly appreciated!
5  Using Arduino / Installation & Troubleshooting / pin 13 blinking on reset on: December 27, 2012, 11:37:19 pm
Hello,

Every time I reset my Arduino, the little yellow LED next to pin 13 flashes a few times... it's not that I mind the blinking, but pin 13 is directly connected to a shield I built and the initial pulsing is messing up my circuit. Is there a way to stop this? I can post my code if needed, but I don't think it's the problem (this happens regardless of the uploaded sketch).

Thanks!
6  Using Arduino / Microcontrollers / Re: replacing Atmega chips on: October 08, 2012, 03:06:33 pm
As I said, it is a 328 chip.
7  Using Arduino / Programming Questions / Re: Pin 1 (Serial TX) usage on: October 08, 2012, 02:19:02 pm

Thank you! I'll be sure to try this.
8  Using Arduino / Programming Questions / Pin 1 (Serial TX) usage on: October 08, 2012, 01:41:32 pm
I'm currently working on an arduino sketch (EEPROM programmer) that receives serial data from a computer, then outputs data\address info through the I/O pins. However, I need one more I/O pin for the address bus... Since I'm only receiving data through the serial port, I was hoping that I could use pin 1 (TX) for digital I/O, but the Arduino wouldn't listen to my digitalWrite commands.

Is there any way I can use pin 1 in my project while still receiving serial data?
9  Using Arduino / Microcontrollers / replacing Atmega chips on: October 08, 2012, 01:15:59 pm
I have an Arduino Duemilanove board with an included ATMEGA328P chip in the IC socket. Over a few years of tinkering, I've managed to fry a few I/O pins, so I think it's time I replace the microcontroller.

Now, most places only sell replacement microcontrollers pre-loaded with the UNO bootloader—can I use this in my Duemilanove board?

Also-- has anyone come up with a good method for prying-out the chip from its socket??  smiley-mr-green


Thanks,

bob800
10  Using Arduino / Displays / Re: Interfacing a 320x240 monochrome LCD display on: September 16, 2012, 04:24:13 pm
MarkT,

Thank you for your thorough reply. I'm in the process of building\tinkering with a Z80 microcomputer, and I was hoping that I could use the LCD in conjunction with my Arduino for a fairly simple video display. I guess that's not the case! smiley-lol

I guess it would be easiest to use a TV as a display and to forget about this LCD...

Anyway, thank you for your suggestions!
11  Using Arduino / Displays / Re: Interfacing a 320x240 monochrome LCD display on: September 16, 2012, 09:52:13 am
Thank you for your replies!

Have you considered that this is probably a VGA or similar video interface, lacking framebuffer?

It does seem that this is the case... but in a standard VGA connector, you have red, green, blue, etc. Why is the LCD supplied with a 4-bit data input when it's only monochrome? Is each "block" of the LCD divided up into 16 parts, or something?

According to this post: http://www.gammon.com.au/forum/?id=11608, it does appear that monochrome VGA generation is possible with a bare arduino.  But how do I substitute RGB connections with a 4-bit, monochrome video connection? Should I "shift out" the VGA pixel output from the Arduino sketch into a 4-bit, parallel output?

There is some useful information linked off http://www.ebay.co.uk/itm/300549241743?nma=true&si=1LwTMK4vM07338rQO5p7ppJ%2B8NE%3D&rt=nc&_trksid=p4340.l2557&orig_cvip=true

Including the requirement for -27volts, apparently.

Yes, thank you, it was that listing in the first place that pointed me to right datasheets and that Word document. However, I was hoping that instead of using that $35 external controller, I could use my Arduino...
12  Using Arduino / Displays / Interfacing a 320x240 monochrome LCD display on: September 15, 2012, 05:25:43 pm
I bought this for $5 at Electronic Goldmine, deluding myself into thinking it would be an easy hookup: http://www.goldmine-elec-products.com/prodinfo.asp?number=G18246

After much searching I think I've found the actual datasheet: http://www.hmangas.com/Electronica/Datasheets/LCD/EW32F50YLY.pdf. With this info I was able to turn the thing on, getting a bright green backlight and some random lines\noise on the screen.

Aside from the power supply wiring, I have (almost) no idea of how to interface this with my Arduino. It looks like the LCD does not contain a built-in controller aside from the row\column drivers, so this would have to be implemented in the Arduino (is this possible?)

The only other information I found was a Hitachi pdf describing the operation of an essentially identical type of LCD display (see attachment). From the timing diagram I've concluded the following:

  • FLM = First Line Marker/New Frame
  • CL1 = Load data into column dr"ive"rs"
  • CL2 = CP (pixel data clock)
(these abbreviations were listed on my LCD's datasheets; the interpretations come from the attached PDF)

It also described the implementation of the timing signals:

Quote
--Channel 0 can be configured to produce a CP pulse (Pixel Data Clock). This takes the form of a 50% duty
square wave.
--Channel 1 can be configured to produce a Load signal  (Line Pulse). This takes the form of a 1/(X/4) duty
square wave. This can be clocked by the output from channel 0 (where X = number of columns, 4 = LCD data
bus width)
--Channel 2 can be configured to produce a Frame pulse (First Line Marker). This takes the form of a 1/Y duty
square wave. This can be clocked by the output of channel 1 (where Y = number of rows)

I wrote three "analogWrite" statements in an attempt to create these channels with the Arduino, though they're running at the default PWM frequency (500 Hz?)...

This is about as far as I could from these datasheets and my limited knowledge of electronics... I would REALLY appreciate it if someone could point me in the right direction! (e.g. how do I send the data at the correct times? How do the data pins affect what appears on the screen?

Thanks,

bob800
13  Using Arduino / Project Guidance / Re: Laser communication to BASIC Stamp 2 on: April 04, 2011, 04:40:46 pm
Thanks for the suggestions!

As always, though, bob800 should post schematics and code - for both ends - and it will help all of us immensely to help him track down this issue.
Here's the code for the transmitter end:
Code:
char c;
void setup()   {               
  Serial.begin(300);
}


void loop()                     
{
if (Serial.available() > 0) {

c = Serial.read();
                if (c=='@')
                {
                  Serial.println("\n");
                }
                else
                {
                Serial.print(c);
                }
}
}
The receiving end (in the BASIC stamp's PBASIC 2.5 language):
 
Code:
' {$STAMP BS2}
' {$PBASIC 2.5}
letter   VAR     Byte
Main:
  DO
    SERIN 1, 3313, [letter]
    DEBUG letter
  LOOP
  END

See the attachments for schematics of the overall setup and the comparator circuit (which I just scanned out of Basic Electronics by Forrest Mims III). I'm using the exact same circuit, except I replaced the buzzer with the BASIC stamp serial pin and ground.

Any more suggestions would be greatly appreciated!
14  Using Arduino / Project Guidance / Laser communication to BASIC Stamp 2 on: April 03, 2011, 09:18:39 pm
I'm trying to send text files via laser to a BASIC STAMP 2, with an Arduino Duemilanove as transmitter. I connected the serial pin of the Arduino to a transistor which switches a laser on/off to send data, and I have a photo-resistor on the receiving end. The photo-resistor is attached to a comparator circuit using a LM339 comparator. The output finally is attached to the BASIC Stamp serial input pin, which prints the data to the screen using the SERIN function.

Anyway, the setup works fine at baud rates 300 and 600. However, once I change the rate to 1200 or 2400, I only get gibberish on the receiving computer (BASIC stamp side). Any ideas one why this is happening? Any help would be appreciated. Thanks!
Pages: [1]