increase the frequency over 300 hz
hey guys,
my name raunak , have write program can change frequency. no matter how ever changes make frequency not going on 300hz.
here program.
string instring = ""; // string hold input
const int ledpin = 9;
const int ininder = 5;
void setup() {
// open serial communications , wait port open:
serial.begin(9600);
pinmode(ledpin, output);
pinmode(ininder, input);
while (!serial) {
; // wait serial port connect. needed native usb port only
}
}
void loop() {
if (serial.available() > 0) {
int inchar = serial.read();
if (isdigit(inchar)) {
instring += (char)inchar;
}
if (inchar == '\n') {
serial.println(instring.toint());
// int = analogread(ininder);
// serial.println(i);
int = 0;
while(i==0){
digitalwrite(ledpin, high);
delay(5000/instring.toint());
delay(1);
serial.println(5000/instring.toint());
digitalwrite(ledpin, low);
delay(5000/instring.toint());
delay(1);
analogread(i);
}
instring = ""
;
}}}
my name raunak , have write program can change frequency. no matter how ever changes make frequency not going on 300hz.
here program.
string instring = ""; // string hold input
const int ledpin = 9;
const int ininder = 5;
void setup() {
// open serial communications , wait port open:
serial.begin(9600);
pinmode(ledpin, output);
pinmode(ininder, input);
while (!serial) {
; // wait serial port connect. needed native usb port only
}
}
void loop() {
if (serial.available() > 0) {
int inchar = serial.read();
if (isdigit(inchar)) {
instring += (char)inchar;
}
if (inchar == '\n') {
serial.println(instring.toint());
// int = analogread(ininder);
// serial.println(i);
int = 0;
while(i==0){
digitalwrite(ledpin, high);
delay(5000/instring.toint());
delay(1);
serial.println(5000/instring.toint());
digitalwrite(ledpin, low);
delay(5000/instring.toint());
delay(1);
analogread(i);
}
instring = ""
;
}}}
for our sakes, including yours, please auto format code before posting , use code tags when do. done looks this
it not answer question may make problem easier find.
code: [select]
string instring = ""; // string hold input
const int ledpin = 9;
const int ininder = 5;
void setup()
{
// open serial communications , wait port open:
serial.begin(9600);
pinmode(ledpin, output);
pinmode(ininder, input);
while (!serial)
{
; // wait serial port connect. needed native usb port only
}
}
void loop()
{
if (serial.available() > 0)
{
int inchar = serial.read();
if (isdigit(inchar))
{
instring += (char)inchar;
}
if (inchar == '\n')
{
serial.println(instring.toint());
// int = analogread(ininder);
// serial.println(i);
int = 0;
while (i == 0)
{
digitalwrite(ledpin, high);
delay(5000 / instring.toint());
delay(1);
serial.println(5000 / instring.toint());
digitalwrite(ledpin, low);
delay(5000 / instring.toint());
delay(1);
analogread(i);
}
instring = ""
;
}
}
}
it not answer question may make problem easier find.
Arduino Forum > Using Arduino > Programming Questions > increase the frequency over 300 hz
arduino
Comments
Post a Comment