我正在运行raspi Model B Rev 2 512MB,我安装了模块并成功打开了一个用于写入的引脚。成功地使LED闪烁。 然后我尝试打开一个端口进行阅读,我得到了错误
{错误:EIO:i / o错误,写错误:-5,代码:' EIO',系统调用:'写' }
这是代码的相关部分。
public partial class SuspiciousListManagementDialog : BaseForm, ISuspiciousListManagementView
{
#region ISuspiciousListManagementView
public ILinkPresentationView LinkPresentationView { get; set; }
public event EventHandler SelectedTypeChanged;
public event EventHandler SelectedHistoryTypeChanged;
public event EventHandler SelectedShowOnlyActiveChanged;
//public event EventHandler Loaded;
protected virtual void OnSelectedShowOnlyActiveChanged()
{
var handler = SelectedShowOnlyActiveChanged;
if (handler != null) handler(_showOnlyOneCheckBox.Checked, EventArgs.Empty);
}
protected virtual void OnSelectedTypeChanged()
{
var handler = SelectedTypeChanged;
if (handler != null) handler(_listTypeComboBox.SelectedValue, EventArgs.Empty);
}
protected virtual void OnSelectedHistoryTypeChanged()
{
var handler = SelectedHistoryTypeChanged;
if (handler != null) handler(_historyTypeComboBox.SelectedValue, EventArgs.Empty);
}
//protected virtual void OnLoaded()
//{
// var handler = Loaded;
// if (handler != null) handler(this, EventArgs.Empty);
//}
public ICommand BrowseFileCommand { get; set; }
public ICommand UploadCommand { get; set; }
public ICommand RefreshCommand { get; set; }
public new void ShowDialog(System.Windows.Forms.IWin32Window owner)
{
base.ShowDialog(owner);
base.StartPosition = FormStartPosition.CenterParent;
}
public object AllTypesDataSource
{
get;
set;
}
private SuspiciousListType _selectedType;
public SuspiciousListType SelectedType
{
get;
set;
}
private string _filePath;
public string FilePath
{
get { return _filePath; }
set
{
_filePath = value;
_filePathTextBox.Text = value;
((DelegateCommand)UploadCommand).RaiseCanExecuteChanged();
}
}
//it is possible. You can create a custom control that inherets from UserControl. Then, set the column type to Text and the EditType to Custom.
//You then need to hook up onto the grids InitCustomEdit and EndCustomEdit events where you will perform the custom control logic.
private object _historyDataGridSource;
public object HistoryDataGridSource
{
get { return _historyDataGridSource; }
set
{
_historyDataGridSource = value;
_dataGrid.DataSource = value;
_dataGrid.Refresh();
}
}
public object AllHistoryAvailableTypesDataSource
{
get;
set;
}
public SuspiciousFilteredListType SelectedHistoryType
{
get;
set;
}
public bool ShowOnlyActive
{
get;
set;
}
#endregion
public SuspiciousListManagementDialog()
{
InitializeComponent();
LinkPresentationView = new LinkPresentationView();
//base.Load += (s, a) => OnLoaded();
base.Load += OnLoad;
base.Closed += OnSuspiciousListManagementDialogClosed;
//_dataGrid.InitCustomEdit += _dataGrid_InitCustomEdit;
//_dataGrid.EndCustomEdit += _dataGrid_EndCustomEdit;
}
private void grdCookies_InitCustomEdit(object sender, InitCustomEditEventArgs e)
{
//CheckedComboBox cmb = new CheckedComboBox();
//cmb.VisualStyle = VisualStyle.Office2007;
//cmb.ComboStyle = ComboStyle.DropDownList;
//cmb.DropDownDataSource = e.Column.Key.Equals(CookiesConstants.COOKIE_HOST) ? _presenter.GetHosts() : _presenter.GetProtocols();
//cmb.DropDownValueMember = CookiesConstants.COOKIE_KEY;
//cmb.DropDownDisplayMember = CookiesConstants.COOKIE_KEY;
//cmb.DropDownList.ColumnAutoResize = true;
//cmb.RetrieveStructure();
//cmb.UncheckAll();
//if (e.Row.RowType == RowType.NewRecord && e.Value != null)
//{
// cmb.Text = e.Value.ToString();
//}
//else
//{
// if (e.Row.Cells[CookiesConstants.COOKIE_ID].Value != null)
// cmb.CheckedItems = _presenter.GetSelectedList((int)e.Row.Cells[CookiesConstants.COOKIE_ID].Value, e.Column.Key.Equals(CookiesConstants.COOKIE_HOST) ? CookiesPresentationPresenter.ListType.Hosts : CookiesPresentationPresenter.ListType.Protocols);
//}
//cmb.DropDownList.ColumnHeaders = InheritableBoolean.False;
//if (e.Column.Key.Equals(CookiesConstants.COOKIE_HOST))
// cmb.Enabled = _presenter.IsHostsListEnabled(e.Row.Cells[CookiesConstants.COOKIE_PROTOCOL].Value);
//e.EditControl = cmb;
}
private void grdCookies_EndCustomEdit(object sender, EndCustomEditEventArgs e)
{
//CheckedComboBox cmb = e.EditControl as CheckedComboBox;
//if (cmb == null) return;
//if (e.Column.Key.Equals(CookiesConstants.COOKIE_HOST))
//{
// if (!(string.IsNullOrEmpty(cmb.Text) && e.Row.Cells[CookiesConstants.COOKIE_HOST].Value == null))
// {
// string cellValue = e.Row.Cells[CookiesConstants.COOKIE_HOST].Value == null
// ? string.Empty : e.Row.Cells[CookiesConstants.COOKIE_HOST].Value.ToString().Replace(" ", "");
// if (!cellValue.Equals(cmb.Text.Replace(" ", "")))
// {
// e.Row.Cells[CookiesConstants.COOKIE_HOST].Value = cmb.Text;
// }
// }
//}
//else
//{
// if (!(string.IsNullOrEmpty(cmb.Text) && e.Row.Cells[CookiesConstants.COOKIE_PROTOCOL].Value == null))
// {
// string cellValue = e.Row.Cells[CookiesConstants.COOKIE_PROTOCOL].Value == null
// ? string.Empty : e.Row.Cells[CookiesConstants.COOKIE_PROTOCOL].Value.ToString().Replace(" ", "");
// if (!cellValue.Equals(cmb.Text.Replace(" ", "")))
// {
// e.Row.Cells[CookiesConstants.COOKIE_PROTOCOL].Value = cmb.Text;
// if (_presenter.IsHostsListEnabled(e.Row.Cells[CookiesConstants.COOKIE_PROTOCOL].Value) == false)
// {
// e.Row.Cells[CookiesConstants.COOKIE_HOST].Value = string.Empty;
// }
// }
// }
//}
//if (e.Row.Cells[CookiesConstants.COOKIE_ID].Value != null)
// _presenter.SetSelectedList((int)e.Row.Cells[CookiesConstants.COOKIE_ID].Value,
// cmb.CheckedItems,
// e.Column.Key.Equals(CookiesConstants.COOKIE_HOST) ? CookiesPresentationPresenter.ListType.Hosts : CookiesPresentationPresenter.ListType.Protocols);
}
void OnSuspiciousListManagementDialogClosed(object sender, EventArgs e)
{
this.FilePath = null;
_listTypeComboBox.SelectedItemChanged -= (s, a) => OnSelectedTypeChanged();
_historyTypeComboBox.SelectedItemChanged -= (s, a) => OnSelectedHistoryTypeChanged();
_showOnlyOneCheckBox.CheckStateChanged -= (s, a) => OnSelectedShowOnlyActiveChanged();
UploadCommand.CanExecuteChanged -= OnBrowseFileCommandCanExecuteChanged;
}
private void OnLoad(object sender, EventArgs e)
{
_listTypeComboBox.DataSource = AllTypesDataSource;
_historyTypeComboBox.DataSource = AllHistoryAvailableTypesDataSource;
_listTypeComboBox.SelectedItemChanged += (s, a) => OnSelectedTypeChanged();
_historyTypeComboBox.SelectedItemChanged += (s, a) => OnSelectedHistoryTypeChanged();
_showOnlyOneCheckBox.CheckStateChanged += (s, a) => OnSelectedShowOnlyActiveChanged();
UploadCommand.CanExecuteChanged += OnBrowseFileCommandCanExecuteChanged;
_uploadButton.Enabled = UploadCommand.CanExecute(this);
_dataGrid.LoadingRow += _dataGrid_LoadingRow;
_listTypeComboBox.SelectedIndex = 0;
_historyTypeComboBox.SelectedIndex = 0;
}
}
});
var gpio = require('rpi-gpio');
server.listen(8080, function() {
console.log('Servidor corriendo en http://localhost:8080');
gpio.setup(7, gpio.DIR_OUT, control);
gpio.setup(22, gpio.DIR_IN, gpio.EDGE_BOTH, control);
这是我看到使用gpio readall的引脚分配,我想从GPIO6读取,因此我调用22(物理端口)我也尝试了25(BCM端口),结果相同。
任何线索??