ah ok.
well. i changed it like this:
// library
#include <SoftwareSerial.h>
// Pin for 7 segment display
#define rxPin 2
#define txPin 3
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
long randNumber;
void setup(){
mySerial.begin(9600);
// define pin modes for tx, rx, led pins:
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// if analog input pin 0 is unconnected, random analog
// noise will cause the call to randomSeed() to generate
// different seed numbers each time the sketch runs.
// randomSeed() will then shuffle the random function.
randomSeed(analogRead(0));
}
void loop() {
// print a random number from 0 to 9999
randNumber = random(10000);
mySerial.println(randNumber);
delay(1000);
}
and now the display is working, but i does not only give numbers, but also other characters.
and it works perfect in the serial monitor if i put it like this (then i see numbers between 0 and 10000 in the serial monitor, but not at my 7 segment display)
// library
#include <SoftwareSerial.h>
// Pin for 7 segment display
#define rxPin 2
#define txPin 3
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
long randNumber;
void setup(){
Serial.begin(9600);
// define pin modes for tx, rx, led pins:
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// if analog input pin 0 is unconnected, random analog
// noise will cause the call to randomSeed() to generate
// different seed numbers each time the sketch runs.
// randomSeed() will then shuffle the random function.
randomSeed(analogRead(0));
}
void loop() {
// print a random number from 0 to 9999
randNumber = random(10000);
Serial.println(randNumber);
delay(1000);
}
what is going wrong ?
i hope i'm clear now.
and thanks for helping!