I try to create custom arduino node for MAX7219 based 8x8 led array
I use this
codeI get these errors:
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' does not name a type
'maxSingl_aaa8fd169f0e47bb9cebb7c744d00f24' was not declared in this scope
variable or field 'putByt_aaa8fd169f0e47bb9cebb7c744d00f24' declared void
'byt_aaa8fd169f0e47bb9cebb7c744d00f24' was not declared in this scope
expected '}' at end of input
I think "byte" is not supported. Actually it is hard to debug node's code.
It would be better if you place line numbers in custom node and display error number line.
Where to put C function definitions? in setup code or in declaration code?
<Nodes>
<Node>
<UniqueID>2f251e71-5084-4c68-a0dc-a6ff6121b797</UniqueID>
<AssemblyType>Embrio.NodeEngine.AgentController.Nodes.AgentControllerCustomArduinoNode</AssemblyType>
<NodeType>Пользовательский узел Ардуино</NodeType>
<UserDefinedName></UserDefinedName>
<Description>A node that lets you write any Arduino code to interact with the Arduino hardware. Can be both an input and output.</Description>
<NodeColor>201,204,227,255</NodeColor>
<X>0</X>
<Y>0</Y>
<Width>636</Width>
<IncludeCode></IncludeCode>
<DeclerationCode>int dataIn = 2;
int load = 3;
int clock = 4;
int maxInUse = 4; //change this variable to set how many MAX7219's you'll use
int e = 0; // just a varialble
// define max7219 registers
byte max7219_reg_noop = 0x00;
byte max7219_reg_digit0 = 0x01;
byte max7219_reg_digit1 = 0x02;
byte max7219_reg_digit2 = 0x03;
byte max7219_reg_digit3 = 0x04;
byte max7219_reg_digit4 = 0x05;
byte max7219_reg_digit5 = 0x06;
byte max7219_reg_digit6 = 0x07;
byte max7219_reg_digit7 = 0x08;
byte max7219_reg_decodeMode = 0x09;
byte max7219_reg_intensity = 0x0a;
byte max7219_reg_scanLimit = 0x0b;
byte max7219_reg_shutdown = 0x0c;
byte max7219_reg_displayTest = 0x0f;
</DeclerationCode>
<SetupCode> void putByte(byte data) {
byte i = 8;
byte mask;
while(i > 0) {
mask = 0x01 << (i - 1); // get bitmask
digitalWrite( clock, LOW); // tick
if (data & mask){ // choose bit
digitalWrite(dataIn, HIGH);// send 1
}else{
digitalWrite(dataIn, LOW); // send 0
}
digitalWrite(clock, HIGH); // tock
--i; // move to lesser bit
}
}
void maxSingle( byte reg, byte col) {
//maxSingle is the "easy" function to use for a //single max7219
digitalWrite(load, LOW); // begin
putByte(reg); // specify register
putByte(col);//((data & 0x01) * 256) + data >> 1); // put data
digitalWrite(load, LOW); // and load da shit
digitalWrite(load,HIGH);
}
void maxAll (byte reg, byte col) { // initialize all MAX7219's in the system
int c = 0;
digitalWrite(load, LOW); // begin
for ( c =1; c<= maxInUse; c++) {
putByte(reg); // specify register
putByte(col);//((data & 0x01) * 256) + data >> 1); // put data
}
digitalWrite(load, LOW);
digitalWrite(load,HIGH);
}
void maxOne(byte maxNr, byte reg, byte col) {
//maxOne is for adressing different MAX7219's,
//whilele having a couple of them cascaded
int c = 0;
digitalWrite(load, LOW); // begin
for ( c = maxInUse; c > maxNr; c--) {
putByte(0); // means no operation
putByte(0); // means no operation
}
putByte(reg); // specify register
putByte(col);//((data & 0x01) * 256) + data >> 1); // put data
for ( c =maxNr-1; c >= 1; c--) {
putByte(0); // means no operation
putByte(0); // means no operation
}
digitalWrite(load, LOW); // and load da shit
digitalWrite(load,HIGH);
}
pinMode(dataIn, OUTPUT);
pinMode(clock, OUTPUT);
pinMode(load, OUTPUT);
//beginSerial(9600);
digitalWrite(13, HIGH);
//initiation of the max 7219
maxAll(max7219_reg_scanLimit, 0x07);
maxAll(max7219_reg_decodeMode, 0x00); // using an led matrix (not digits)
maxAll(max7219_reg_shutdown, 0x01); // not in shutdown mode
maxAll(max7219_reg_displayTest, 0x00); // no display test
for (e = 1; e <= 8; e++) { // empty registers, turn all LEDs off
maxAll(e, 0);
}
maxAll(max7219_reg_intensity, 0x0f & 0x0f); // the first 0x0f is the value you can set
// range: 0x00 to 0x0f</SetupCode>
<ImageName>arduino.png</ImageName>
<InfoURL></InfoURL>
<CodeDefinitions>
<CodeDefinition>
<UpdateCondition>EveryUpdate</UpdateCondition>
<Code> maxSingle(1, B10000001);
maxSingle(2, B10000001);
maxSingle(3, B10000001);
maxSingle(4, B11111111);
maxSingle(5, B10000001);
maxSingle(6, B10000001);
maxSingle(7, B10000001);
maxSingle(8, B10000001); </Code>
<UniqueID>8478106d-d7b1-4a43-a447-559732e00a0b</UniqueID>
</CodeDefinition>
</CodeDefinitions>
<Inputs></Inputs>
<Outputs></Outputs>
</Node>
</Nodes>
Edited by user Saturday, April 04, 2015 9:16:27 PM(UTC)
| Reason: Not specified