我正在使用他们的website中的Pololu软件,以便将Raspberry Pi 0W连接到RoboClaw电机驱动器。使用简单的PWM代码,我可以一次连接到电动机驱动器,但是一旦结束代码,便无法再次运行它。我收到此错误:minikube stop
rm -rf ~/.minikube
minikube start
我试图找出如何在每次运行代码之间无需重新启动Raspberry Pi。
这是我的代码:
class MySql
{
private MySqlConnection connection;
private string server;
private string database;
private string uid;
private string password;
//Constructor
public MySql()
{
Initialize();
}
//Initialize values
private void Initialize()
{
server = "mydomain.com";
database = "dbName";
uid = "Username";
password = "Password";
string connectionString;
connectionString = "SERVER=" + server + ";" + "DATABASE=" +
database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";";
connection = new MySqlConnection(connectionString);
}
//open connection to database
private bool OpenConnection()
{
try
{
connection.Open();
return true;
}
catch (MySqlException ex)
{
//When handling errors, you can your application's response based
//on the error number.
//The two most common error numbers when connecting are as follows:
//0: Cannot connect to server.
//1045: Invalid user name and/or password.
switch (ex.Number)
{
case 0:
MessageBox.Show("Cannot connect to server. Contact administrator");
break;
case 1045:
MessageBox.Show("Invalid username/password, please try again");
break;
}
return false;
}
}
//Close connection
private bool CloseConnection()
{
try
{
connection.Close();
return true;
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message);
return false;
}
}