App Designer not identifying 'readVoltage'
    조회 수: 6 (최근 30일)
  
       이전 댓글 표시
    
I had made a callback for a button in App Designer that when pushed would read voltages from an arduino 'A0' pin and it was wokring. Suddenly when I tried to run the app again I was getting an error of "Undefined function 'readVoltage' for input arguments of type 'double'". I had not changed the code in between this happening but now I cannot fix it. 
function ButtonPushed(app, event)
    clc
    global b
    x1=0;
    global go
    go=true;
    while go
        tempA1 = readVoltage(b, 'A0');
        tempA2 = 32+(9/5)*(tempA1*100);
        x1=[x1 tempA2];
        plot(app.UIAxes,x1);
        drawnow
        pause(1);
    end
end
댓글 수: 0
답변 (2개)
  Ameer Hamza
      
      
 2020년 9월 21일
        You have used 'b' as a global variable. In the base workspace, you need to define it as an Arduino object
b = arduino;
If it has some other type, you will get this error
댓글 수: 4
  Fazli Wadood
 2023년 3월 22일
        I have use this its working. 
clc
    global b
    b = arduino;
    x1=0;
    global go
    go=true;
    while go
        tempA1 = readVoltage(b, 'A0');
        tempA2 = 32+(9/5)*(tempA1*100);
        x1=[x1 tempA2];
        plot(app.UIAxes,x1);
        drawnow
        pause(1);
    end
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


