'范围'未在此范围内声明

时间:2017-11-16 16:08:02

标签: c++ arduino

我是Arduino编码的新手,我不确定将变量显示为serialPrint时遇到了什么问题。这是我的代码的一部分:

void loop() 
{
  int force1raw = analogRead(FSR_PIN1);
  int force2raw = analogRead(FSR_PIN2);
  int force3raw = analogRead(FSR_PIN3);
  float force1 = force1raw;
  float force2 = force2raw;
  float force3 = force3raw;

  for (int i = 0; i < 1000; i++)
  {
    // Use ADC reading to calculate voltage:
    float f1v = force1 * VCC / 1023.0;
    // Use voltage and static resistor value to 
    // calculate FSR resistance:
    float f1r = R_DIV * (VCC / f1v - 1.0);
  }
    Serial.println("Resistance 1: " + String(f1r) + " ohms");
    // Estimate force based on slopes in figure 3 of
    // FSR datasheet:
    float force;
    float f1g = 1.0 / f1r; // Calculate conductance
    // Break parabolic curve down into two linear slopes:
    if (f1g <= 600) 
      force1f = (f1g - 0.00075) / 0.00000032639;
    else
      force1f =  f1g / 0.000000642857;
    Serial.println("Force 1: " + String(force2f) + " g");
    Serial.println();

    delay(100);

1 个答案:

答案 0 :(得分:2)

那么,

f1r

它使用范围刚刚结束的变量{

在C ++中,当一个变量在一个范围内定义时(在某个}# find the colors within the specified boundaries and apply # the mask mask = cv2.inRange(image, lower, upper) output = cv2.bitwise_and(image, image, mask = mask) # show the images cv2.imshow("images", np.hstack([image, output])) 之间),它就不存在于它之外。