Show Posts
Pages: 1 ... 6 7 [8] 9 10 ... 73
106  Using Arduino / Programming Questions / Re: TVout demo not compiling on: March 25, 2014, 12:25:44 am
Not quite, the class modification is fine, except for the return:
Quote
class pollserial : public Print {
   public:
      pt2Funct begin(long);
      void end();
      uint8_t available(void);
      int read(void);
      void flush(void);
      virtual size_t write(uint8_t);
      using Print::write; // pull in write(str) and write(buf, size) from Print
                return 0x01;
};

In the location where the class functions are defined ( with code between {} ) you need to modify the function.

Maybe in pollserial.cpp there should be something that resembles the function below.
Code:
void pollserial::write(uint8_t){
  //some code
}

you need to modify it to look like:
Code:
size_t pollserial::write(uint8_t){
  //some code
  return 0x01;
}
Thanks very much, pYro
107  Using Arduino / Programming Questions / Re: TVout demo not compiling on: March 24, 2014, 10:02:45 pm
Quote
        I think he means this
Code:
class pollserial : public Print {
public:
pt2Funct begin(long);
void end();
uint8_t available(void);
int read(void);
void flush(void);
virtual size_t write(uint8_t);
using Print::write; // pull in write(str) and write(buf, size) from Print
                return 0x01;
}; 
That causes even more errors!
108  Using Arduino / Programming Questions / Re: TVout demo not compiling on: March 24, 2014, 12:21:48 pm
Goto Pollserial.h, on line 46 change virtual void to virtual size_t.
Also inside the function you need to return 0x01

When Arduino was upgraded to verison 1.0 the Print library was modified. Your library is a pre 1.0 version.
Thanks, pYro, but I'm not certain what you mean by
Quote
Also inside the function you need to return 0x01
Here's the original code:
Code:
/*
  pollserial.h Heavily modified version of:

  HardwareSerial.h - Hardware serial library for Wiring
  Copyright (c) 2006 Nicholas Zambetti.  All right reserved.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
  Modified July 2010 by Myles D. Metzler
*/

#ifndef PSERIAL_H
#define PSERIAL_H

#include <inttypes.h>
#include "Print.h"

typedef struct {
uint8_t head;
uint8_t tail;
unsigned char * buffer;
} rbuffer;

//define a void function() return type.
typedef void (*pt2Funct)();

class pollserial : public Print {
public:
pt2Funct begin(long);
void end();
uint8_t available(void);
int read(void);
void flush(void);
virtual void write(uint8_t);
using Print::write; // pull in write(str) and write(buf, size) from Print
};

void USART_recieve();
#endif
109  Using Arduino / Programming Questions / TVout demo not compiling [Fixed] on: March 24, 2014, 12:32:01 am
I've placed all the header files in the libraries folder but get the following errors:
Code:
In file included from C:\Users\Henry\Documents\Arduino\libraries\TVout\pollserial.cpp:28:
C:\Users\Henry\Documents\Arduino\libraries\TVout\/pollserial.h:46: error: conflicting return type specified for 'virtual void pollserial::write(uint8_t)'
C:\Program Files\Arduino\hardware\arduino\cores\arduino/Print.h:48: error:   overriding 'virtual size_t Print::write(uint8_t)'
Is this something stupid that I've (not) done (more than likely) or is it an error in the TVout code?

Also, how can I get to see ALL the tabs when some are off the RHS of the IDE screen? I can't find how to scroll through them.
110  Topics / Product Design / Re: Arduino Dial Up Modem shield on: March 24, 2014, 12:14:46 am
I've no use for one, but it looks a very good idea. With it, you'd be able to have a remote Arduino automatically 'phone home' to upload collected data. But couldn't a USB shield, with a USB mobile [cell] phone dongle do the same job?
111  Using Arduino / General Electronics / Re: Simulate rubber button on: March 23, 2014, 11:51:25 pm
What voltage does the equipment use? What is the voltage across each of the open switches?
112  Using Arduino / Project Guidance / Re: Convert BCD to decimal for switch case on: March 23, 2014, 11:04:49 pm
This works for plain binary, which is what you appear to be using, but not BCD.
Code:
value = 0;
value = value + (digitalRead(pin8));  //Most significant bit
value = (value*2) + (digitalRead(pin7)); 
value = (value*2) + (digitalRead(pin6)); 
value = (value*2) + (digitalRead(pin5));   //Least significant bit
Value will hold a number 0 to 15 or, in your case, 0 to 12.
113  Using Arduino / Project Guidance / Re: New arduino project idea with projector suggestion needed on: March 23, 2014, 10:47:21 pm
Projectors are not very portable. You can't fit one in your pocket.
114  Using Arduino / Project Guidance / Re: Controlling Rotational Position of Shaft using a stepper motor and potentiometer on: March 23, 2014, 10:31:58 pm
Get rid of the delay()s. You won't be able to read any inputs whilst the delays are in use. See the blink without delay example in the IDE and also look at Finite State Machine to overcome the problem.
115  Community / Bar Sport / Re: Normal English phrase embarrassing in the US on: March 23, 2014, 12:10:27 am
pronunciation.

still long word, can't see how spel chkr let that through first  time.
Harry Potter may use a spell checker. I use a spelling checker.
116  Using Arduino / Project Guidance / Re: easiest switches multiplexing method? on: March 22, 2014, 10:29:26 pm
Hi, as title, what multiplexing method would you suggest for someone with very little knowledge and very bad soldering skills?  smiley-kiss
I'm planning to do something that requires a lot of push buttons and toggle switches
How many is 'a lot'?
A 74HC4067 can handle 16 inputs or outputs, two of them can handle 32 inputs using only 6 Arduino pins.
117  Using Arduino / General Electronics / Re: Relay Board on eBay with 8 Relays on: March 22, 2014, 12:17:29 am
I still use plain old DC for my locos. The focus of my layout is more on the buildings and details. The motors I want to control are for my Carnival rides. Some are 12 volt DC and some are 16 volt AC. But it sounds like a motor shield might be a better way to go. I'll look into it once the rides are built.
You can only use PWM on your DC motors. I'd be interested in seeing the rides working.  Maybe you could put a video on YouTube when they're completed.
118  Using Arduino / General Electronics / Re: Relay Board on eBay with 8 Relays on: March 21, 2014, 11:53:18 pm
What are the advantages/disadvantages to using a board with transistors or optocouplers? Does one or the other draw less current from the Arduino? And, when would optocouplers be required, or not? I just want to make sure I buy the correct board. I'm going to be using the relays to turn small AC and DC motors on and off. Thanks.
If you want to control your locos with the Mega, you could use a motor shield instead of relays. That way, you can use PWM to accurately control their speed and direction. PWM overcomes the 'sticktion' in DC motors, giving you scale slow speed starts and stops, unlike plain DC, which gives a very unrealistic 'startled rabbit' start.
Also Google "traffic lights Arduino" to see how others have programmed them. No need to re-invent the wheel.  smiley-fat
119  Using Arduino / Programming Questions / Re: sorting conveyor on: March 21, 2014, 11:19:50 pm
Again, you have given us only a few words of description. The video is interesting and helpful. I now know how I would plan your project. The problem is that I have no idea how you are planning to do it.

You need to write a script (like for a play or a movie - not a computer) describing every single thing that happens as one piece moves along the conveyor. Once you have done that it should be reasonably simple to write code that does the same thing.

...R
Agreed. 10 minutes spent with a pen and paper, accurately defining what is needed, can save hours of programming time. If it's an accurate and complete, stepwise definition, the program will be almost written.
120  Using Arduino / Project Guidance / Re: How to go about hacking a printer/materials that would work this idea? on: March 21, 2014, 10:14:23 pm
What sort of picture? B&W or colour? How big (pixels)?
What sort of printer? Inkjet, laser, thermal?
Until you define your objectives more clearly there's not much help anyone can give you.
Pages: 1 ... 6 7 [8] 9 10 ... 73