Go Down

Topic: Twitter World Mood Light (Read 1 time) previous topic - next topic

kdyches17

This is an amazing project and I love the concept. However I cannot for the life of me get this thing to work. It's been over a year and I've gotten the guts to try again.

Here is the error I keep getting.

worldmood2:35: error: 'Serial' was not declared in this scope
worldmood2.cpp: In function 'void setup()':
worldmood2:190: error: 'Serial' was not declared in this scope
worldmood2.cpp: In function 'void loop()':
worldmood2:210: error: 'Serial' was not declared in this scope

This is what the errors are attached to:

Quote

TwitterParser twitterSearchParser(Serial, TWEETS_PER_PAGE);



I'm using Steve Hobleys version of code and the wishield

Thanks Guys

PaulS

That one snippet of code, completely out of context, isn't of any use in helping you solve your problem.

However, the Serial object is declared in HardwareSerial.h, which is included, indirectly, in sketches, but may not be being included in your cpp file.

kdyches17

Do I need to include that into my sketch by doing the #include thing or do i need to add it to some .cpp file? im very new at this, sorry for the noobieness

Thanks for the help

PaulS

Quote
Do I need to include that into my sketch by doing the #include thing

No, you need to include it in the cpp file that is failing to compile.

jdonavan

Make sure you're including wprogram.h in your cpp file.

kdyches17

It does say that wprograms.h is included.

PaulS

Quote
Make sure you're including wprogram.h in your cpp file.

Quote
It does say that wprograms.h is included.

Which is it? wprogram.h or wprograms.h?

You'd get the help you need a lot faster if you'd just post your code instead of playing 20 questions.

kdyches17

Sorry sorry. program no s. Here's the beggining of the files where the includes are. If you need more let me know and i will post the rest.

heres the worldmood2.pde:
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Title : WorldMood.pde
Author : http://www.instructables.com/member/RandomMatrix/

Description :
Arduino program to compute the current world mood.
An Arduino connects to any wireless network via the WiFly module, repeatedly searches Twitter for tweets with emotional content,
collates the tweets for each emotion, analyzes the data, and fades or flashes the color of an LED to reflect the current World Mood:
Red for Anger, Yellow for Happy, Pink for Love, White for Fear, Green for Envy, Orange for Surprise, and Blue for Sadness.

Created  : April 22 2010
Modified : June 2010 to suppoert WiShield by Steve Hobley (www.stephenhobley.com)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
#include <HtmlParser.h>
#include <TwitterParser.h>
#include <string.h>
#include <WorldMood.h>
#include <LED.h>
#include <avr/pgmspace.h>
#include <WiServer.h>

#define WIRELESS_MODE_INFRA   1
#define WIRELESS_MODE_ADHOC   2

#define DEBUG 1

uint8 twitter_ip[] = {128,121,146,100};   // Twitter

// be sure to change this if you edit the rpp value above
#define TWEETS_PER_PAGE (30)

TwitterParser twitterSearchParser(Serial, TWEETS_PER_PAGE);  <------ Thats where the compiler gets snagged.



Here's the WorldMood.h:
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Title : WorldMood.h
Author : http://www.instructables.com/member/RandomMatrix/

Description :
A store for what the World Mood has been in the past and what it is currently.
use RegisterTweets after searching twitter for tweets with emotional content
and register the tweets per second and the particular mood.
Call ComputeCurrentMood to get a normalized and more stable idea of the World Mood.
ComputeCurrentMoodIntensity gives an idea of how strong the current mood is
           

Created : April 22 2010
Modified :

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/

#ifndef _WorldMood_h
#define _WorldMood_h

#include "wprogram.h"
#include "HardwareSerial.h"



And here is the coveted WorldMood.cpp file:
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Title : WorldMood.h
Author : http://www.instructables.com/member/RandomMatrix/

Description :
see Header

Created : April 22 2010
Modified :

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
#include "WorldMood.h"
#include "WProgram.h"

#define INVALID_MOOD_VALUE (-1)
//#define DEBUG (1)

WorldMood::WorldMood(HardwareSerial& print,
                    float emotionSmoothingFactor,
                    float moodSmoothingFactor,
                    float moderateMoodThreshold,
                    float extremeMoodThreshold,
                    const float* const worldTemperamentRatios)  




I hope that's what you were asking for. I guess I know less then I thought Ianks for the patience.

PaulS

Quote
You'd get the help you need a lot faster if you'd just post your code instead of playing 20 questions.

Well, shame on me for omitting the word "ALL" from that statement. Let me try again.

You'd get the help you need a lot faster if you'd just post ALL of your code instead of playing 20 questions.

Snippets don't cut it.

kdyches17

I attached the .rar with everything that i downloaded for this project and then the .h .cpp and .pde that i am currently using.

PaulS

Quote
I attached the .rar with everything that i downloaded for this project

Downloaded from where? Is there anything on that site that indicates which version of the IDE that code works with?

It appears that the problem is that when the TwitterParser object is constructed, the Serial object has not yet been constructed. Like all other classes, the TwitterParser class should have a begin() method that takes a reference to a HardwareSerial object rather than a constructor that takes a reference to a HardwareSerial object.

Go Up