Build an automated brewery and run it from an SE.Well, I accidentally an original Beehive (15EUR). Wonder what to do with it.
Meh, you could do that with a timer relay. Or did you mean actually making the bread and toppings?... I don't drink and I don't like compacts! How about a pizzabox-driven pizza maker?
Nice build!Here we are... I built the nice kit sent by @aladds
pascal OSErr ADBIOSetPortA(Byte theAddress,long theChannel,enum value theValue,long theTime)
{
OSErr myErr;
Byte dataTransmitted;
Byte DataBuffer[3], Listen,ADBReg;
unsigned short ADBIOCompletionPPC[3] = {0x14BC, 0x0001, 0x4E75};
ADBReg = 2; // set the port to enumerated A
dataTransmitted = 0; //set up completionflag
DataBuffer[0] = 2;
DataBuffer[1] = (theValue == high) ? theChannel - 1 & 0x03 | 0x40 : theChannel - 1 & 0x03 ;
DataBuffer[2] = theTime;
if (CountADBs() == 0) return errAINoADBs; //no devices connected to the bus
Listen = (theAddress << 4) + 8 + ADBReg;
#if GENERATINGPOWERPC
myErr = ADBOp ((Ptr)&dataTransmitted,(UniversalProcPtr)ADBIOCompletionPPC,(Ptr)DataBuffer,Listen);
#else
myErr = ADBOp ((Ptr)&dataTransmitted,(ADBServiceRoutineUPP)ADBIOCompletion68k,(Ptr)DataBuffer,Listen);
#endif
if (myErr != noErr) {
return myErr;
}
while(!dataTransmitted); // Loop until ADBOp has completed
return noErr;
}
enum port {
A = 2, //Port A
B = 1 //Port B
};
Aren't there only two ports?Has anyone managed to use C to set port values?
Port A works... I can set values, but I need to set values in port B, configured as output.
The library strangely only has function ADBIOSetPortA but not an ADBIOSetPortB.
I tried to copy the function for port A and make the equivalent for B, but it didn't work.
This is the function...
Code:pascal OSErr ADBIOSetPortA(Byte theAddress,long theChannel,enum value theValue,long theTime) { OSErr myErr; Byte dataTransmitted; Byte DataBuffer[3], Listen,ADBReg; unsigned short ADBIOCompletionPPC[3] = {0x14BC, 0x0001, 0x4E75}; ADBReg = 2; // set the port to enumerated A dataTransmitted = 0; //set up completionflag DataBuffer[0] = 2; DataBuffer[1] = (theValue == high) ? theChannel - 1 & 0x03 | 0x40 : theChannel - 1 & 0x03 ; DataBuffer[2] = theTime; if (CountADBs() == 0) return errAINoADBs; //no devices connected to the bus Listen = (theAddress << 4) + 8 + ADBReg; #if GENERATINGPOWERPC myErr = ADBOp ((Ptr)&dataTransmitted,(UniversalProcPtr)ADBIOCompletionPPC,(Ptr)DataBuffer,Listen); #else myErr = ADBOp ((Ptr)&dataTransmitted,(ADBServiceRoutineUPP)ADBIOCompletion68k,(Ptr)DataBuffer,Listen); #endif if (myErr != noErr) { return myErr; } while(!dataTransmitted); // Loop until ADBOp has completed return noErr; }
I tried changing ADBReg to 1 (or B), as in the header I can see...
Code:enum port { A = 2, //Port A B = 1 //Port B };
Hah, sorry, my bad. I got muddled.Actually I meant "C language", sorry
Setting port A with the included function works fine (I can hear the relays) but I don't manage to set port B... I wonder why they only gave a function to set port A in the library...The command
Hah, sorry, my bad. I got muddled.
I haven't used C to control one, but usually you have to set up the port direction and mode before using "set". Are you sure there aren't more commands to set up the port?
I don't have the C library to hand.
Only one of the ports has relays, the other uses transistors that won't click.Setting port A with the included function works fine (I can hear the relays) but I don't manage to set port B... I wonder why they only gave a function to set port A in the library...
Using the hypercard tool all works fine.
Yeah… I’m testing port B with LEDs, which I can light with the HyperTalk tool.Only one of the ports has relays, the other uses transistors that won't click.
ADBReg = 2; // set the port to enumerated A
dataTransmitted = 0; //set up completionflag
DataBuffer[0] = 2;
ADBReg = B; // set the port to enumerated B
dataTransmitted = 0; //set up completionflag
DataBuffer[0] = B;
DataBuffer[0] = 2;