Recent Posts

Pages: [1] 2 3 ... 10
1
Generale / Re: Automazione Tende antipiog...
Last post by simosere - Today at 08:52 pm
grazie Guglielmo!!! da imparare c'è molto!!!

a questo punto i problemi con il display che random mi escono caratteri a vanvera continuano... valuto ogni cosa e vi sarei grato se mi date consigli per risolvere il tutto in maniera definitiva... anche cambiare il display.

grazie mille
2
Robotics / Re: [Help] 2 DC motors cannot ...
Last post by KassC - Today at 08:52 pm
//Defining pin
//Analog Pin
int JoyStick_X = 0; //x
int JoyStick_Y = 1; //y

int JoyStick_X2 = 4; //x2
int JoyStick_Y2 = 5; //y2

//Digital Pin
int JoyStick_Z = 4; //Button 1
int JoyStick_Z2 = 2; //Button 2
int Button_LED_Z = 8; //Pin  output to Button_LED_Z
int Button_LED_Z2 = 7; //Pin  output to Button_LED_Z2
int Analog_LED_1 = 6; //pwm Pin  output to Analog_LED_1
int Analog_LED_2 = 9; //pwm Pin  output to Analog_LED_2

int Motor_A_Enable = 3; //pmw pin    
int Motor_A_DirA = 5;
int Motor_A_DirB = 10;
int Motor_B_Enable = 11; //pmw pin    
int Motor_B_DirA = 12;
int Motor_B_DirB = 13;


//analog value
int sensorValue_X ; // value read from the Joystick Value
int outputValue_X ; // value output to the PWM
int sensorValue_Y ; // value read from the Joystick Value
int outputValue_Y ; // value output to the PWM
int sensorValue_X2 ; // value read from the Joystick Value
int outputValue_X2 ; // value output to the PWM
int sensorValue_Y2 ; // value read from the Joystick Value
int outputValue_Y2 ; // value output to the PWM

void setup() {
 // put your setup code here, to run once:
 
 //Define Button LED's pin)
 pinMode(JoyStick_Z, INPUT);
 pinMode(JoyStick_Z2, INPUT);
 pinMode(Button_LED_Z, OUTPUT);
 pinMode(Button_LED_Z2, OUTPUT);

 pinMode(Motor_A_Enable, OUTPUT);
 pinMode(Motor_A_DirA, OUTPUT);
 pinMode(Motor_A_DirB, OUTPUT);
 pinMode(Motor_B_Enable, OUTPUT);
 pinMode(Motor_B_DirA, OUTPUT);
 pinMode(Motor_B_DirB, OUTPUT);
 
 Serial.begin(9600); // 9600 bps
}

void loop() {
 // put your main code here, to run repeatedly:
 //Press buttons to lit up different Button_LED
 
 if(digitalRead(JoyStick_Z2) == HIGH)
 {
 digitalWrite(Button_LED_Z2,HIGH);
 }
 else if(digitalRead(JoyStick_Z) == HIGH)
 {
 digitalWrite(Button_LED_Z,HIGH);
}
else if(digitalRead(JoyStick_Z) == HIGH && digitalRead(JoyStick_Z2) == HIGH)
 {
 digitalWrite(Button_LED_Z,HIGH);
 digitalWrite(Button_LED_Z2,HIGH);
}
else {
digitalWrite(Button_LED_Z,LOW);
digitalWrite(Button_LED_Z2,LOW);
}
delay(50);




 // read the analog in value:
 //PROBLEM HERE: here can only read 1 analog value

 sensorValue_X = analogRead(JoyStick_X);
 sensorValue_X >>= 1;
 sensorValue_X2 = analogRead(JoyStick_X2);
 sensorValue_X2 >>= 1;


if(sensorValue_X > 255){
   analogWrite(Motor_A_Enable,(sensorValue_X - 256));
   digitalWrite(Motor_A_DirB, LOW);  
   digitalWrite(Motor_A_DirA, HIGH);
   analogWrite(Analog_LED_1, (sensorValue_X - 256));

 }
 else
   if(sensorValue_X < 255){
     analogWrite(Motor_A_Enable,(255 - sensorValue_X));
     digitalWrite(Motor_A_DirA, LOW);
     digitalWrite(Motor_A_DirB, HIGH);
     analogWrite(Analog_LED_1, (255 - sensorValue_X));

   }
   else{
     digitalWrite(Motor_A_DirA, LOW);
     digitalWrite(Motor_A_DirB, LOW);
     digitalWrite(Analog_LED_1, LOW);
   }

if(sensorValue_X2 > 255){
   analogWrite(Motor_B_Enable,(sensorValue_X2 - 256));
   digitalWrite(Motor_B_DirB, LOW);
   digitalWrite(Motor_B_DirA, HIGH);
   analogWrite(Analog_LED_2, (sensorValue_X2 - 256));

 }
 else
   if(sensorValue_X2 < 255){
     analogWrite(Motor_B_Enable,(255 - sensorValue_X2));
     digitalWrite(Motor_B_DirA, LOW);
     digitalWrite(Motor_B_DirB, HIGH);
     analogWrite(Analog_LED_2, (255 - sensorValue_X2));

   }
   else{
     digitalWrite(Motor_B_DirA, LOW);
     digitalWrite(Motor_B_DirB, LOW);
     digitalWrite(Analog_LED_2, LOW);
   }



 
 delay(50);
}
3
Displays / Re: problem with HX8357D based...
Last post by mhf1987 - Today at 08:46 pm
Sorry another question, does utft support hx8357d?

on this page :

https://forum.arduino.cc/index.php?topic=446606.0

 you have said that : "UTFT does not support HX8357-D with SPI."

so does it support the 8 Bit or 16 Bit mode?

thanks.
4
Robotics / [Help] 2 DC motors cannot read...
Last post by KassC - Today at 08:45 pm
sorry for disturbing u guys, im new to arduino and im trying to make a robot car by using 2 dc motors and 2 joystick to control each dc motors

my equipments:
1) Arduino Uno
2) Keyestudio L298P Motor Driver Shield (ks0007)
3) 2 DC motors
4) 4 AA battery holder (google tell me its 6volt)

my problem:
so i have 2 joystick x value (JoyStick_X & JoyStick_X2), and the dc motors work fine and can turn both directions when testing using digitalWrite, but when i changed it to 2 analog value for each dc motors, 1 dc motors (Motor_A) cant turn reverse direction and can only go forward with 1 speed, but Motor_B still work fine can turn both direction and have different speed using pwm. But if only use 1 analog value for 2 dc motors, both motors work fine

i searched in google but seem like everyone only use 1 joystick to control 1 or more motors at once rather than using 2 joysticks for each motors
5
Project Guidance / Re: using raspberry pi 3 b+
Last post by gdsports - Today at 08:44 pm
You can always gets the latest version (currently 1.8.5) of the IDE from here. For Raspberry Pi, download the Linux ARM version.

https://www.arduino.cc/en/Main/Software
6
Oops. The "0.12" was a typo. I meant to write 0.1. Sorry about that. I'm sure there is a range around 0.1 uF that will work fine.
7
You're welcome!

You can easily add a short tick from the buzzer each time you light a new led.
More complex, but doable: add a comet queue to the lit led of the outer ring.
You can also do some animations for the third strip.

I can help of course...
Those are all good improvements.  When you say to animate the third strip do you mean on matches and on misses (which i could probably do myself) or do you mean at other times like when waiting for a spin.  The tick would also be cool, but would it also tick while the wheel goes round or just during selection?
8
Deutsch / Re: 230V an GPIO
Last post by DrDiettrich - Today at 08:39 pm
Jedenfalls leuchtet der Prüfende bei sattem zweipoligem Anschluß besser :-]

Aber nach all den Beiträgen ist mir immer noch nicht klar, worum es eigentlich geht. Ein Gerät das (wo?) mitloggt wann das Licht ein- und ausgeschaltet wird, und dafür keinen Strom verbraucht, kann man nicht mit einer elektrischen Schaltung realisieren - die braucht Strom. Meine Lösung wäre ein Hammer, der die Lampe zerschlägt und per Aufkleber "Licht ist aus" das Abschalten logt.
9
Oh, indeed I didn't connect DTR to the RST pin. So basically with this layout as is, whenever I want to upload a new sketch I need to always hit the Reset switch, is it?

Is there any other value of the capacitors that will do, or is 0.12 uF the only possible value to for the capacitor if I may know?

I will try this and report back to you on the results then pert. Thanks!
10
Your code will not compile at the moment because you have stray code outside the loop and not within any function...

void loop(){
{        <<---- HERE YOU START THE CODE FOR THE LOOP FUNCTION
duration = pulseIn(PWM0, HIGH);
digitalWrite(outhigh, LOW);
digitalWrite(outlow, LOW);
}        <<---- HERE YOU END THE CODE FOR THE LOOP FUNCTION


// THE CODE BELOW IS NOT BELOGING TO ANYTHING... WON'T COMPILE...
if (duration > 1050 && duration < 1150)
  {





To your questions (assuming you put the code in the right place :) )

if constructs are more appropriate to check intervals as you do here
A switch statement would work using the ... interval notation of GCC but this is not part of the current C++ standard
So you could go with something like this (not standard)
Code: [Select]
void setup() {
  Serial.begin(115200);
  int i = 50;
  switch (i) {
    case 0 ... 3:   Serial.println(1); break;
    case 4 ... 10:  Serial.println(2); break;
    case 11 ... 67: Serial.println(3); break;
    default: Serial.println(4);
  }
}

void loop() {}


or this version which is not breaking any standard
Code: [Select]
void setup() {
  Serial.begin(115200);
  int i = 50;

  if (i >= 0 && i <= 3) {
    Serial.println(1);
  } else if (i >= 4 && i <= 10) {
    Serial.println(2);
  } else if (i >= 11 && i <= 67) {
    Serial.println(3);
  } else
    Serial.println(4);
}

void loop() {}




this is the line that capture the frequency on pin PWM0
Code: [Select]
duration = pulseIn(PWM0, HIGH);The pulseIn() function here waits for the PWM0 pin to go from LOW to HIGH, starts timing, then waits for the pin to go LOW and stops timing and returns (an unsigned long) the length of the pulse in microseconds which you store in duration (or gives up and returns 0 if no complete pulse was received within the timeout)

so you would have to call this function for every pin and then walk through the decision tree. if the intervals and actions are similar, that would be best resolved in a function that you call with the pin number (which would be best declared as a const byte rather than an int) as a parameter


for the interval management, you can proceed the way you do at the moment or put the interval values in an array or a struct that has min, max and a function to call and your code could just be a loop through the intervals so that you don't write tons of if...

as you iterate through the pins, you build up an "answer" message that will take care of the column for example
Pages: [1] 2 3 ... 10