sensebox / React-Ardublockly

This repository contains the new senseBox learn- and programming environment powered by google Blockly and React
Apache License 2.0
2 stars 7 forks source link

[Blockly][Codegenerator] Error in function of dfrobot sound sensor for MCU S2 #324

Open janwirwahn opened 2 months ago

janwirwahn commented 2 months ago

following problems with this block: image

  1. function to read ADC should be changed to analogReadMilliVolts() correct function for sensor reading:
int getSoundValue(int sensorPin) {
  float v = analogReadMilliVolts(sensorPin) / 1000.0;
  float decibel;
  if (v <= 0.6) decibel = 0.0;
  if (v >= 2.6) decibel = 130.0;
  else decibel = v * 50.0;
  return int(decibel);
}
  1. when selecting IO port, wrong pin number is applied select IO2-3 results in pin number 1 instead of 3. same for IO4-5 and IO6-7