OttoDIY / blockly

Otto Blockly; a fully integrated graphical programming for any type of Arduino projects, including robots, ready to install in your computer, it works offline and also online
https://www.ottodiy.com/software
GNU General Public License v2.0
113 stars 80 forks source link

Redundant Arduino code when using buzzer blocks #168

Closed IvanR3D closed 1 year ago

IvanR3D commented 2 years ago

Using the buzzer blocks as shown in the picture, generate this Arduino code:

void setup() {
  pinMode( 13 , OUTPUT);
  pinMode(13, OUTPUT);
    tone(  13,261,125);
   delay(125);
  tone(13,440,1000);
  delay(1000);
}
void loop() {
}

Declaring the pinMode 2 times. Captura de Pantalla 2022-06-03 a la(s) 5 50 55 p  m

Maybe creating a block to declare the pinMode and taking this line out of the blocks could be useful for this.

cparrapa commented 1 year ago

Thanks @IvanR3D Fixed in https://github.com/OttoDIY/blockly/commit/03860be0e943fb8cb3b3399f83ff19866b9a86ab