不使用以太网屏蔽将数据从arduino发送到sql server
我已经试过了不使用以太网屏蔽将数据从arduino发送到sql server,arduino,Arduino,我已经试过了 <?php $servername = "127.0.0.1:3307"; //localhost $username = "root"; $password = ""; // Create connection $conn = new mysqli($servername, $username, $password); try {
<?php
$servername = "127.0.0.1:3307"; //localhost
$username = "root";
$password = "";
// Create connection
$conn = new mysqli($servername, $username, $password);
try {
$conn = new PDO("mysql:host=$servername;dbname=test", $username,$password);
// set the PDO error mode to exception
echo "Connected successfully";
$sql = "INSERT INTO test.senrdata (temp) VALUES (".$_GET["value"].")";
echo "query " . $sql ;
$conn->exec($sql);
// Execute SQL statement
}
?>
我尝试了Arduino代码,该代码提供传感器数据并将这些数据存储在服务器上。我找到了如下解决方案: 要求: 1.Visual studio 2.阿杜伊诺 3.Sql server 应采取的步骤: 1.通过USB电缆将arduino套件连接到电脑 2.更新PC上COM端口的驱动程序。(此PC->管理->设备管理器->端口(COM和LPT)) 3.创建Windows控制台应用程序,该应用程序在Arduino正在侦听的同一COM端口上侦听,并将数据存储在数据库(SQL server)中 4.创建读取此数据并显示值的WEB应用程序