求助各位吧友
proteus吧
全部回复
仅看楼主
level 1
作业要求是proteus仿真做一个水位检测装置,然后我的连接图如下,不知道对不对。是按老师教的声控灯来的。然后程序在arduino上没有报错,复制到proteus上就报错了。能不能帮我看下是什么问题。(程序在评论区)
2022年10月30日 11点10分 1
level 1
void setup() {
// put your setup code here, to run once:
int distances[20];
int oriData[20];
}
void loop() {
// put your main code here, to run repeatedly:
int distances[20];
int oriData[20];
for(int i = 0 ; i< 20; i++)
{int DistanceMeasure();
{ int outputPin,inputPin;
digitalWrite(outputPin, LOW);
delayMicroseconds(2);
digitalWrite(outputPin, HIGH); // Pulse for 10μs to trigger ultrasonic detection
delayMicroseconds(10);
digitalWrite(outputPin, LOW);
int distance = pulseIn(inputPin, HIGH); // Read receiver pulse time
distance= distance/58; // Transform pulse time to distance
delay(50);
return distance; //Ourput distance
}
}
int everageFilter(int oriData[20]);
int sum=0;
for(int i = 0; i < 20; i++)
{
sum=sum+oriData[i];
}
int everage=sum/20;
return everage;
if( everage < 100 )
{ void LEDOn();
{
digitalWrite(13,HIGH);
}
}
else if (everage> 200)
{void LEDBlink();
{
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
}
}
else if((everage>100)&&(everage<200))
{void LEDOff();
{
digitalWrite(13,LOW);
}
}
}
2022年10月30日 11点10分 2
level 1
最后修改了报错成这样
2022年10月31日 03点10分 3
1