int saklar_pwm[13][10]= { {0,0,0,0,0,0,0,0,0,0}, //= 0
{1,0,0,1,0,1,0,1,0,1}, //= 1
{1,0,1,1,0,0,0,1,0,1}, //= 2
{1,0,1,1,0,0,1,1,0,0}, //= 3
{1,0,1,1,0,0,0,1,0,1}, //= 4
{1,0,0,1,0,1,0,1,0,1}, //= 5
{0,0,0,0,0,0,0,0,0,0}, //= 6
{0,1,0,1,0,1,0,1,0,1}, //= 7
{0,1,0,0,1,1,0,1,0,1}, //= 8
{0,1,0,0,1,1,0,0,1,1}, //= 9
{0,1,0,0,1,1,0,1,0,1}, //= 10
{0,1,0,1,0,1,0,1,0,1}, //= 11
{0,0,0,0,0,0,0,0,0,0}, //= 12
};
int Delay[jeda]={681.5, 729.7, 1652.8, 3746, 1652.8, 792.7, 1363, 792.7, 1652.8, 3746, 1652.8, 792.7, 681.5};
void setup() {
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
}
void loop() {
for (byte count =0; count <13;++count){
saklar_pwm_mode(count);
delayMicroseconds[count[jeda]);
}
if (byte count =13){
count=0;}
void saklar_pwm_mode(byte digital) {
byte pin=2;
for (byte pwmCount=0;pwmCount<10; pwmCount++){
digitalWrite(pin, saklar_pwm[digit][pwmCount]);
++pin;
}
}
Where does the loop() function end ?
Does that look correct to you, OP?
int Delay[jeda] = {681.5, 729.7, 1652.8, 3746, 1652.8, 792.7, 1363, 792.7, 1652.8, 3746, 1652.8, 792.7, 681.5};
It won't cause an error when compiled but you can't put a floating point value in an int variable
260 bytes of precious RAM to store 17 bytes of data is not a great approach.
Oops
After the OP has applied the fixes, post the repaired or fixed code.
i tried float but still same.. umm doesn't it get rounded when I use int on float number? ex: 18.8 to 19?
pictures of code sucks.
It is obvious from the picture you did NOT address the other issues that have been brought forth.
Consider post#6 if (byte count = 13). What the frack does if (byte count = 13) do? If such things are not addressed, how do you expect to get your project to work?
No, it does not get rounded.
It appears to me that what you meant to write was:
int saklar_pwm[13][10] =
{
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //= 0
{1, 0, 0, 1, 0, 1, 0, 1, 0, 1}, //= 1
{1, 0, 1, 1, 0, 0, 0, 1, 0, 1}, //= 2
{1, 0, 1, 1, 0, 0, 1, 1, 0, 0}, //= 3
{1, 0, 1, 1, 0, 0, 0, 1, 0, 1}, //= 4
{1, 0, 0, 1, 0, 1, 0, 1, 0, 1}, //= 5
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //= 6
{0, 1, 0, 1, 0, 1, 0, 1, 0, 1}, //= 7
{0, 1, 0, 0, 1, 1, 0, 1, 0, 1}, //= 8
{0, 1, 0, 0, 1, 1, 0, 0, 1, 1}, //= 9
{0, 1, 0, 0, 1, 1, 0, 1, 0, 1}, //= 10
{0, 1, 0, 1, 0, 1, 0, 1, 0, 1}, //= 11
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //= 12
};
float Delay[13] =
{
681.5, 729.7, 1652.8, 3746, 1652.8,
792.7, 1363, 792.7, 1652.8, 3746,
1652.8, 792.7, 681.5
};
void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
}
void loop()
{
for (byte count = 0; count < 13; ++count)
{
saklar_pwm_mode(count);
delayMicroseconds(Delay[count] + 0.5); // Round to nearest integer
}
}
void saklar_pwm_mode(byte digit)
{
for (byte pwmCount = 0; pwmCount < 10; pwmCount++)
{
digitalWrite(pwmCount + 2, saklar_pwm[digit][pwmCount]);
}
}
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.