Wizfi210사용시 보드에서 읽은값을 웹페이지로 보여주기
Wireless
No replies yet. Be the first to reply.
Join the discussion.
Wireless
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: Wizfi210사용시 보드에서 읽은값을 웹페이지로 보여주기
by jameskim ·
안녕하세요.
Battery 값을 읽어서 웹페이지로 표시하는 부분에 대해서 간략히 설명드리겠습니다.
BatteryVol = analogRead(BatteryPin); BatteryVol *= 5; BatteryVol /= 1023;BatteryPin은 실제 배터리의 전압값이 연결된 analog input 핀입니다.
IO level은 5V이고, ADC resolution은 10bits이기 때문에 현재의 sensing 된 값을 최대값 5V에 비해서 어디쯤에 해당하는지 전환하는 과정이 필요합니다.
그것이 위의 코드 입니다.
if(BatteryVol < 3.2) myHTMLPages.SetCurrentBatteryStatus(3); else if(BatteryVol < 3.4) myHTMLPages.SetCurrentBatteryStatus(2); else myHTMLPages.SetCurrentBatteryStatus(1);RC 카에 장착된 배터리는 3.7V가 full charge 배터리로 3.4V이하이면 충전이 필요하고 3.2V 이하이면 배터리가 과방전상태가 되기 때문에 안내 메시지를 웹페이지로 표시해야합니다.
myHTMLPages.SetCurrentBatteryStatus() 함수가 현재 배터리의 상태값을 지정하는 함수입니다.
while(myHTMLPages.GetNextLine((char *)rcvdBuf)) { // Serial.print((char *)rcvdBuf); myClient[i].write((byte *)rcvdBuf); }위 코드는 myHTMLPages에서 정의한 HTML 문서 데이터를 읽어 와서 웹브라우저로 전송하는 부분입니다.
WizFi2x0 라이브러리의 HTMLPages.cpp 파일내에 GetNextLine() 함수를 보시면 실제 HTML 문서 데이터를 읽을 때, 이전에 설정한 배터리 상태값에 따라서 다른 라인을 읽어오도록 되어져 있습니다.
결국, 배터리 전압값과 연결된 ADC를 읽고 그것을 5V 기준의 값으로 환산한다면 현재 전압값에 따라서 배터리 상태값을 설정하고 배터리 상태값에 따라서 필요한 HTML 문서 라인을 읽어서 상대방(PC상의 웹브라우저)에게 전달하는 구조입니다.
도움이 되셨기를 바랍니다.
감사합니다.
RE: Wizfi210사용시 보드에서 읽은값을 웹페이지로 보여주기
by geoworld ·
답변 감사합니다. 배터리를 비교하는 부분에 대해 이제 알겠네요.
그러면 궁금한게 직접 읽은 배터리 값, 즉 BatteryVol값을 직접 페이지에 띄우려면 어떻게 해야하는지요?
myClient[i].write() 를 이용해야 할 것 같은데 이부분에 대해서도 알고싶습니다.
감사합니다.