문자열에 텍스트를 출력하는 Python 스크립트가 있습니다. 온라인 텍스트를 Arduino 마이크로 컨트롤러로 가져올 수 있도록 시도하고 있습니다. 즉, 작업 흐름은 다음과 같습니다 : 텍스트 소스> Python> ??? > Arduino> 최종 결과.GET 요청에 사용할 수있는 것을 출력하는 Flask가있는 웹 서버 만들기
나는 Heroku에서 샘플 Flask 코드를 사용하여이 기능이 작동하도록 실험하기 시작했습니다. 플라스크에 대한 그들의 코드는 다음과 같습니다
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
if __name__ == '__main__':
# Bind to PORT if defined, otherwise default to 5000.
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port)
내가 HTTP 내 Heroku가 응용 프로그램에 대한 요청을받을 수 있나요하려고 할 때, 그것은 나에게 내가이 스크립트는 정말 출력되지 아무것도 않기 때문에이으로 판단되는 404을 제공합니다. 내가 GET 요청을 수행 할 Processing.org 웹 사이트에서이 처리 응용 프로그램을 사용할 때 예를 들어, :
HTTP/1.1 200 OK
Date: Sat, 31 Mar 2012 22:27:10 GMT
Server: Apache
Cache-control: no-cache, no-store
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache
Content-Length: 968
Connection: close
Content-Type: text/html; charset=UTF-8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http- equiv="refresh" content="0;url=http://earthlink-help.com/main?
InterceptSource=0&ClientLocation=us&ParticipantID=xj6e3468k634hy3945zg3zkhfn7zfgf6&FailureMode =1&SearchQuery=&FailedURI=http%3A%2F%2Fmy_domain_name.com%2F&AddInType=4&Version=2.1.8-1.90base&Referer=&Implementation=0"/><script type="text/javascript">url="http://earthlink-help.com/main?InterceptSource=0&ClientLocation=us&ParticipantID=xj6e3468k634hy3945zg3zkhfn7zfgf6&FailureMode=1&SearchQuery=&FailedURI=http%3A%2F%2Fmy_domain_name.com%2F&AddInType=4&Version=2.1.8-1.90base&Referer=&Implementation=0";if(top.location!=location){var w=window,d=document,e=d.documentElement,b=d.body,x=w.innerWidth||e.clientWidth||b.clientWidth,y=w.innerHeight||e.clientHeight||b.clientHeight;url+="&w="+x+"&h="+y;}window.
location.replace(url);</script></head><body></body></html>
가 AKA : 아무것도 없다
import processing.net.*;
Client c;
String data;
void setup() {
size(200, 200);
background(50);
fill(200);
c = new Client(this, "http://freezing-stream-5123.herokuapp.com/", 80); // Connect to server on port 80
c.write("GET/HTTP/1.1\n"); // Use the HTTP "GET" command to ask for a Web page
c.write("Host: my_domain_name.com\n\n"); // Be polite and say who we are
}
void draw() {
if (c.available() > 0) { // If there's incoming data from the client...
data = c.readString(); // ...then grab it and print it
println(data);
}
}
은 무엇 반환하는 것은 이것이다. "Hello world"는 컬을 사용하여 웹 페이지를 가져올 때 표시되지만 그게 의미가 있는지는 알 수 없습니다.
그럼 내 질문은 : 누군가가 내 문자열을 내가 검색 할 수있는 무언가에 집어 넣을 무언가로 나를 가리킬 수 있습니까? 나는 이것이 어쩌면 어리석은 질문이라는 것을 알았지 만, 나는 웹 서버의 바다에서 완전히 잃어 버렸고, 약간의 지침을 고맙게 생각할 것이다.
감사합니다.