我似乎无法将简单的闪烁程序上传到我的Arduino Nano。我不断收到消息:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
我已经尝试了很多关于Google的建议。 我在Windows 7和Windows上都试过了8台机器和2种不同的Nano :
当我将nano插入USB时,它开始每分钟闪烁LED灯180次。当我开始上传时,L每分钟闪烁约80-100次,闪烁rx然后再次开始快速闪烁L LED。
答案 0 :(得分:1)
截至2018年,如果你有一个真正的Nano(来自Arduino),你可能会因为在2018年1月之后Arduino发布的所有Nanos上的引导程序更新而得到此错误(请阅读此处的注释(以粗体突出显示) :https://www.arduino.cc/en/Guide/ArduinoNano#toc4)。您需要将Arduino AVR Core
更新为Boards Manager
中的Tools -> Board
在ArduinoIDE中的Processor
以下,以使用闪亮的新Nano。
相反,如果你有一个较旧的Nano(早于2018年1月),但最近更新了你的ArduinoIDE,你应该确保ATmega328P (Old Bootloader)
Tools -> Processor
import java.io.FileOutputStream;
import com.itextpdf.layout.element.List;
import com.itextpdf.io.font.FontConstants;
import com.itextpdf.kernel.color.Color;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.border.Border;
import com.itextpdf.layout.border.SolidBorder;
import com.itextpdf.layout.element.Cell;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.element.Table;
import com.itextpdf.layout.element.Text;
import com.itextpdf.layout.property.TextAlignment;
public static void main(String[] args) throws Exception {
try
{
PdfWriter pdfWriter = new PdfWriter("output1.pdf");
PdfDocument pdfDocument = new PdfDocument(pdfWriter);
Document document = new Document(pdfDocument);
document.setLeftMargin(30);
document.setRightMargin(30);
final Table myTable = new Table(new float[]
{ 30, 65, 120, 180, 100, 25 });// { 30, 65, 150, 180, 100, 25 }); works.
setTableProperties(myTable, pdfDocument, 70, 7, "italic", Color.BLACK);
myTable.setFixedLayout();
final PdfFont font = getPdfFont(FontConstants.HELVETICA);
myTable.setFont(font).setFontSize(7).setItalic().setFontColor(Color.WHITE);
//*** Start - Added Header*****
//BLOCK THIS TO See Issue 1 below, UNBLOCK Causes issue 2 and it hangs
createTableHeader(myTable);
//*** End - Added Header *****
//*** Start Add Data ****
equipmentTableData(myTable, "NUMITEMS", false, TextAlignment.CENTER);
equipmentTableData(myTable, "CONDENSADORCONDENSAD", false, TextAlignment.CENTER);
// MATNUMBERUCACHBMPVAIRD4EFANFUC (com.itextpdf.layout.renderer.RootRenderer - Element does not fit current area)
// MATNUMBERUCACHB-PVAIRD4EFANFUC (Works ok.. it wraps at '-')
// MATNUMBERUCACH1MPVAIRD4EFANFUC (added '1' in middle Works ok.. 'MATNUMBERUCACH1MPVAIRD4EF' 'ANFUC')
equipmentTableData(myTable, "MATNUMBERUCACHBMPVAIRD4EFANFUC", false, TextAlignment.CENTER);
equipmentTableData(myTable, "MATERIALDESCRIPTIONDOPKSOPKDKJSLIOULOISOOPWOSKLISL", false, TextAlignment.CENTER);
equipmentTableData(myTable, "DETAILS", false, TextAlignment.CENTER);
equipmentTableData(myTable, "QTY", false, TextAlignment.CENTER);
//*** End Add Data ****
document.add(myTable); // Goes in infinite loop if createTableHeader is enabled above, and i can see pdf file size growing
document.close();
}
catch (final Exception e)
{
System.out.println("Error " + e);
}
}
private static Table createTableHeader(final Table myTable)
{
Cell customCell;
List listforPrepared;
listforPrepared = new List().setSymbolIndent(0).setListSymbol(" ");
listforPrepared.add("Line");
listforPrepared.add("Item");
customCell = new Cell(1, 1).add(listforPrepared).setBackgroundColor(Color.GRAY).setFontColor(Color.WHITE)
.setTextAlignment(TextAlignment.CENTER);
myTable.addHeaderCell(customCell);
listforPrepared = new List().setSymbolIndent(0).setListSymbol(" ");
listforPrepared.add("Tag:");
customCell = new Cell(1, 1).add(listforPrepared).setBackgroundColor(Color.GRAY).setFontColor(Color.WHITE)
.setTextAlignment(TextAlignment.CENTER);
myTable.addHeaderCell(customCell);
listforPrepared = new List().setSymbolIndent(0).setListSymbol(" ");
listforPrepared.add("Material");
listforPrepared.add("Number");
customCell = new Cell(1, 1).add(listforPrepared).setBackgroundColor(Color.GRAY).setFontColor(Color.WHITE)
.setTextAlignment(TextAlignment.CENTER);
myTable.addHeaderCell(customCell);
listforPrepared = new List().setSymbolIndent(0).setListSymbol(" ");
listforPrepared.add("Description");
customCell = new Cell(1, 1).add(listforPrepared).setBackgroundColor(Color.GRAY).setFontColor(Color.WHITE)
.setTextAlignment(TextAlignment.CENTER);
myTable.addHeaderCell(customCell);
listforPrepared = new List().setSymbolIndent(0).setListSymbol(" ");
listforPrepared.add("Detail");
customCell = new Cell(1, 1).add(listforPrepared).setBackgroundColor(Color.GRAY).setFontColor(Color.WHITE)
.setTextAlignment(TextAlignment.CENTER);
myTable.addHeaderCell(customCell);
listforPrepared = new List().setSymbolIndent(0).setListSymbol(" ");
listforPrepared.add("QTY");
customCell = new Cell(1, 1).add(listforPrepared).setBackgroundColor(Color.GRAY).setFontColor(Color.WHITE)
.setTextAlignment(TextAlignment.CENTER);
myTable.addHeaderCell(customCell);
return myTable;
}
private static Table equipmentTableData(final Table Table, final String data, final boolean isGrey, final TextAlignment textAligned)
{
final PdfFont helvetica = getPdfFont(FontConstants.HELVETICA);
final Text dataText = new Text((data)).setFont(helvetica).setFontSize(7).setItalic()
.setFontColor(Color.BLACK); // new Font(Font.FontFamily.HELVETICA, 7, Font.ITALIC);
final Cell cellData = new Cell(1, 1).add(new Paragraph(dataText));
cellData.setTextAlignment(textAligned);
if (isGrey)
{
cellData.setBackgroundColor(Color.LIGHT_GRAY);
}
else
{
cellData.setBackgroundColor(Color.WHITE);
}
cellData.setPadding(0f);
Table.addCell(cellData);
return Table;
}
public static void setTableProperties(Table tblName, PdfDocument pdf, int widthSize, int fontSize, String fontStyle, Color fontColor)
{
tblName.setWidth(pdf.getDefaultPageSize().getWidth() - widthSize); /* Set Width of a Table */
tblName.setFontColor(fontColor); /* Set Font Color */
if (fontStyle.toLowerCase() == "italic")
tblName.setFontSize(fontSize).setItalic();
else if (fontStyle.toLowerCase() == "bold")
tblName.setFontSize(fontSize).setBold();
else if (fontStyle.toLowerCase() == "bold-italic")
tblName.setFontSize(fontSize).setBold().setItalic();
}
public static PdfFont getPdfFont(final String font)
{
try
{
return PdfFontFactory.createFont(font);
}
catch (final Exception e)
{
System.out.println("Error " + e);
}
return null;
}
下的 byte[] arRegistration = oImgBrowser.mGetByteArray(oRegistrationStream);
sRegistrationImage = Convert.ToBase64String(arRegistration);
oRegistrationStream = new MemoryStream(arRegistration);
sRegistrationImage = mCompressString(sRegistrationImage)
public static string mCompressString(string sData)
{
string sCompressedString = "";
if (string.IsNullOrEmpty(sData))
{
throw new ArgumentException("The input data cannot be null");
}
byte[] arData = Encoding.UTF8.GetBytes(sData);
sCompressedString = Convert.ToBase64String(LZ4Codec.Wrap(arData));
return sCompressedString;
}
。 / p>
如果您的Nano不是正版(即第三方Nano),那么您可能必须手动安装使用它所需的引导加载程序。 (第三方应该有关于此的文件)